cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing Ruleset Variables between 2 Rulesets?

former_member277448
Participant
0 Kudos

hello,

I have a function that contains 2 Rulesets - R1 and R2.

R1 is used as a data calculation thingy (we are dealing with a lot of data and data manipulation).

R2 is used to execute a number of Rules that use the data derived in R1.

the data in R1 is stored in Ruleset Variables.

these Ruleset variables are included in R2 (the same GUID).

I was expecting that after R1 is executed and the data is derived and the results stored in the Ruleset variables that when R2 is executed that R2 would have access to the derived data via its Ruleset variables (I hope this makes sense).

but R2 does not seem to be able to see the derived data.

so, my Q is, how can the rules in R2 access the derived data from R1?

I know that I could add some data elements to the functions signature but I am hoping to avoid this.

thank you in advance for any advice.

cheers

Pas.r

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Pas,

unfortunalty bad news for you: The rule set variables are only added to the local context of a rule set and it is therefore not possible to transfer results across rulesets (in the generated code you can see that the ruleset variable is cleared when starting the ruleset execution).

In order to transfer data across ruleset boundaries you have to enhance the global context (ruleset signature)

Cheers

Christian

former_member277448
Participant
0 Kudos

Hello Christian.

Thank you for the prompt reply.

I am not sure what you mean by 'enhance the global context (ruleset signature)'.

do you mean I have to add the data elements to the context of the function that the rulesets are assigned to?

do you mean I need to change the access level of the data elements (to global?).

is there a link you can point me to?

again, thank you for your prompt reply.

Cheers

Pas

0 Kudos

Hi Pas,

sorry for the confusion as I wanted to write function signature instead of ruleset signature.


In general within a function you have the context and the result data object. All data objects that are part of either the context or the result data object are visible within all rulesets and rules in a function.

That is why they are sometimes called "global context" of a function.


Within a ruleset you can enhance this context by local variables (as you did) buit these variables are only visible locally namely in the scope of the ruleset that they are defined in, but not in other rulesets.


To make a long story short: In order to transfer data from one ruleset to another you have to put the corresponding data objects in the context or the result data object.


BR

Christian

Answers (0)