Hello! I'm curious whether or not the amount of data we pass in and out of an Expression Rule has any impact on performance.
Consider the following scenario.
I have a pv!recordType process variable, with three fields: recordType.field1, recordType.field2, recordType.field3.
I want to use two of those fields in an Expression Rule to obtain an Output to use later in the Process Model.
When configuring rule inputs for the Expression Rule, I am facing two options:
1. Pass the whole pv!recordType into the Expression and access the fields within the expression, resulting in one rule input "recordType".
2. Create two separate rule inputs, "field1" and "field2", and access the process variable fields when passing data into the Expression Rule.
Now my question is basically this: is there a real difference between these two approaches, or is it a matter of convention?
Discussion posts and replies are publicly visible
You should do whichever is easier and/or makes for better, more reusable code on your end. If there are performance implications either way, they'd be extremely trivial.
I do not see any difference in performance, but in possible bugs.
When I have a rule input of a record type, I expect to get a fully populated record structure. When people try to optimise their code by selecting only specific fields, this can lead to interesting situations.
So you're suggesting that the first approach is safer? I agree, it also seems easier for a person who will be reusing this rule.
Is it the same with Process Models? I think I read somewhere in the Docs that it is a good practice to minimize the amount of data passed between Processes, but I'm not sure.
For bulky data then I'd say perhaps. Like if you load 100s of rows of a particular CDT, then I'd only pass that info into a subprocess if it's *really* required - since in the case of a subprocess, the data will be copied into that subprocess (whereas anything passed into an expression rule you can consider to essentially be a reference to wherever the original value was being stored).
So what does it mean to pass input into a subprocess as a reference? And when should this box be checked? Sorry to ask so many questions, but I'm curious.
Passing as a reference actually passes a reference to the parent process's data - like a "pointer" in a traditional programming language, more or less - and in those cases, changes to the data in the subprocess will *directly* change the parent process's data value (which can be useful in limited situations). I only ever use it if i *SPECIFICALLY* require it, which is not often.