Getting something to work. Now the solutions has two phases.
1. Opened record, add CI's
- I have modified cm3r link record, added line to assets post expressions. Whole record is:
Field (From/Src): assets File (To/Target): device Format (To/Target): device Field (To/Target): logical.name
$fill.recurse=false $L.idx=nullsub(cursor.line(1), 1);if gui() then ($fill.search.format="device.cm3rrfc.search") if (not null($L.idx in assets in $File)) then ($query="logical.name#\""+$L.idx in assets in $File+"\"") else ($query="true") if ($G.multi and not null(company in $File)) then $query+=" and (company=company in $File or company=\"DEFAULT\")" if $query#"true and " then ($L.void=strclpl($query, 9))
Source Field: assets Target Field: logical.name
$fill.exact=true;$L.idx=nullsub(cursor.line(1), 1);3 in $L.idx in CI.info in $File=logical.name in $L.target;2 in $L.idx in CI.info in $File=x.area in $L.target;1 in $L.idx in CI.info in $File=x.service in $L.target
This is working if user is filling the assets array and found CI logical.name is exactly unique. But if there is two CI with names: "XYZ" and "XYZ -application", then will the "Select Related Records" window open, user selects correct CI and it will be always filled to first line in CI.info array.
I think that $L.idx value is gone when the "Select Related Records" window opens and this is the reason why CI is posted to wrong line in the array. How I could maintain the value from Expressions to Post Expressions even if there is other window at the middle of the filling process? With global variable?
2. Phase is done with format control calculations when users Saves the record. Calculation fills the CI.info array and then queries device table and fills the correct values. This is working.
Could you look at my question and see if your approach can work for mine. I am trying to fill some fields in a table array or VJ when Affected CIs are filled. Something like subtype, status, assignment etc.