I'm using the technique found in the FM 13 advanced training series to generate virtual lists.
I'm using virtual lists to quickly transfer data to a scratch table used for reporting. I have an ExecuteSQL formula to gather some of the data in question:
SELECT GroupID, SUM(RoundedValue)
WHERE CustID_FK = ? and Code < ? and PeriodNumber = 2 and
(GroupID = 68 or GroupID = 3)
GROUP BY GroupID
"|" ; "|" ;
This generates in most cases a dataset of:
68|-3600|3|-7200| <<< as an example for this customer with 68 and 3 being the required group 'names' or headers.
This data is passed via scripting into a field on the scratch table called ListData which has several fields dedicated to particular values, two of which are dedicated to Group68 values and Group3 values. The formula in each is:
Get Value(ScratchTable::ListData;2)<<<For Group 68, -3600
Get Value(ScratchTable::ListData;4)<<<For Group 3. -7200
However, there may be cases where a customer does not have any values associated to either 68 or 3 which obviously reduces the return on the dataset and makes the parse section inaccurate. On my scratch table, I have several fields
If a particular customer has NO value for group 68, the returned data set instead looks like:
and this will break all downstream GetValue(Field;x) calculations.
So, what I really need to have is a reliable way of ALWAYS returning 4 pipe separated results in the situation that a customer has data missing from one or other of the groups, and that's where I'm stuck. If I could get to:
as an example, this would enable me to parse the 0 values to where they should be.
Any help on this one greatly appreciated.