View Only
  • 1.  [GEL] Global persist and arrays

    Posted Aug 06, 2014 03:50 PM

    This is a two pronged question and our Test environment is currently down so I haven't been able to test it, but wanted to reach out to the community to see if others had any thoughts/experience in this particular area.


    Right now we have a few processes that run on update for any idea/project to calculate risk/alignment scores. There are various weight factors used in these calculations. Currently, a custom object "Weight Factors" was created that stores the different values ("alignment_quality=3", "risk_funding=2", etc). On each process run, a SELECT query runs on the DB to grab the required values (one process for alignment, one process for risk each for project and idea, depending). These values very rarely change, maybe once in the last year.


    I am in the process of re-writing these scripts in prep for our 13.2/3 upgrade (currently 13.0) to use XOG instead of direct sql:update commands.


    My question is if there is a better way to handle this sort of thing? This is the first instance I've come across but I'm sure there are similarly designed scripts I haven't begun on yet. Is it better to use an array with the values (align[quality]=3, risk[funding]=2, etc) and place that in a globally persisting variable? I've not yet tried to use arrays or persisting variables so I'm not sure what the implications of either would be, so I'm looking for some opinions.


    How are global variables created? With an otherwise "empty" script that only has their declarations and manually execute that script any time a value is changed?

  • 2.  Re: [GEL] Global persist and arrays

    Posted Aug 06, 2014 05:04 PM

    What I am doing is using core:include.


    I have a number of core include files to handle things like:


    Login / Logout

    Get SessionId

    Get XOG endpoint



    When I find myself coping pieces of script over and over, I look at creating a core:include for that functionality.


    As for firing on value changes, I usually just do a manual execute via a script / program.




  • 3.  Re: [GEL] Global persist and arrays

    Posted Aug 07, 2014 09:06 AM

    Interesting, I had asked awhile back about best practice to reusing code for the same reason you mentioned (XOG web service stuff) and core:include was mentioned there as well, didn't think about it in this context but that should work the same. This is the first time I've gotten back to GEL since that original question so haven't had a chance to try it yet. I dont see core:include in the CA documentation, would you mind just posting a simple example of the format? Does the included file need to be a fully formed GEL script on its own, or can they just be snippets that are basically inserted inline?

  • 4.  Re: [GEL] Global persist and arrays
    Best Answer

    Posted Aug 07, 2014 09:35 AM
      |   view attached

    The include file is formatted just as any other gel script (fully formatted).


    The core:include tag is documented here:


    I am attaching a zip that has three gel files:


    TestLoginInclude.xml (this file does the login and executes a project object read xog)

    Login_Include.xml (the login include file)

    XogReadProjects_Include.xml (the xog read)





    zip   3 KB 1 version

  • 5.  Re: [GEL] Global persist and arrays

    Posted Aug 07, 2014 09:46 AM

    Oooo, this will help quite a bit. Thanks!

  • 6.  Re: [GEL] Global persist and arrays

    Posted Aug 08, 2014 02:21 AM

    Hi Gene,


    Thanks a lot for this tip. Can avoid all those repeating codes using core:include now




  • 7.  Re: [GEL] Global persist and arrays

    Posted Aug 14, 2014 10:50 AM

    Conceptually this is working well for me so far after some initial testing. One thing I have noticed though is that gel:log statements don't appear to be getting written out. gel:out is working fine to the log files, but I can't figure out how to get gel:log to appear as expected. On the original "parent" script it works fine, but none of the included files are writing out.


    Best I can come up with us adding the var attribute and then using gel:log AFTER the original include statement, but that isn't ideal. Have you run in to anythign similar?


    <gel:log level="INFO" category="XOG" var="include_log">Logging into Clarity XOG.</gel:log>
    <gel:log level="INFO" category="XOG" var="include_log">Log in successful ${sessionID}</gel:log>

  • 8.  Re: [GEL] Global persist and arrays

    Posted Aug 15, 2014 02:22 PM

    Well I played around with this and I think this is the only option (gel:log acts differently inside the process engine).


    So you have to capture all your log messages inside a var while in the include file and then log the var out in the main script.


    So the include logs look like this:


    <gel:log message="Starting Login_Include.xml" var="include_log" />
    <gel:log message="SessionID = ${XogSessionId} | EndPoint = ${XogUrl}" var="include_log" />
    <gel:log message="Finish Login_Include.xml" />


    and the main script needs the gel:log to see the include logs


    <core:include file="gel/Login_Include.xml" />           
    <gel:log message="${include_log}"/>