Showing posts with label variable. Show all posts
Showing posts with label variable. Show all posts

Wednesday, August 31, 2016

Using Temporary Variable in FIXParallel

While reading the blogs and forums on using temporary variables in Fix Parallel, I was under the impression that there is no change the way we use it. But I was getting following error when I used to use temp var the same way we used it in FIX command:

"FIXPARALLEL (line 99): Modify the VAR variable inside FIXPARALLEL command Rule"

 However after doing through the documentation and few testing, I found that it's not the case.

Following is the example how we use the temporary variable in FIX command:

VAR V_Period_Start = 20160101;
VAR V_Period_End = 20161231;
VAR V_TotalDays = 0;

FIX(@RELATIVE("Entity_1",0),
        "Budget",
        &WFBudYr
    )
    "Working"
    (
        V_TotalDays = @CalcMgrDateDiff(V_Period_Start, V_Period_End, "day") + 1;


        @RETURN(@CalcMgrDoubleToString (V_TotalDays),INFO);
)
ENDFIX;


Note above that we can declare the variable before the FIX and we can also initialize with a value while declaring. However this is not the case when using the variable (in similar way as above) in FIXParallel command.

Using FIXParallel it can be written as follows:

FIXPARALLEL(8,@RELATIVE("Entity_1",0),
            "Budget",
            &WFBudYr
    )
    THREADVAR V_Period_Start;
    THREADVAR V_Period_End;
    THREADVAR V_TotalDays;

    "Working"
    (
        V_Period_Start = 20160101;
        V_Period_End = 20161231;
        V_TotalDays = @CalcMgrDateDiff(V_Period_Start, V_Period_End, "day") + 1;
       
        @RETURN(@CalcMgrDoubleToString (V_TotalDays),INFO);
)
ENDFIXPARALLEL;


As you can see, when using temp variable within FIXPARALLEL, it must be declared inside the FIXPARALLEL block with the keyword "THREADVAR". Also note that you cannot initialize with any value while declaring the variable.  

Thursday, October 3, 2013

Web-form: Substitution variable error

One of my colleagues was trying to use a substitution variable in a web-form and he got the following error message:

“A substitution variable required for this calculation is undefined. Variable: Years_Act

He defined new substitution variable in planning and assigned the value as “FY10:FY13”.

There is nothing wrong here as this can easily be used in calculation script or business rules but when using this in Web-form, we can only have single valid value not range as shown above.

So, few points to note when using substitution variable in web-form are as follows:

1. Make sure you define substitution variable.
2. Make sure value is not blank
3. Make sure you have assigned a valid member name (value) (not range)