Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am loading some inline data.
When I iterate the rows, some data 'appears' to be missing from fields.
The data is missing where the field value is the same as the rows above it. ('athena' & '*')
i.e. if I make all values unique, then my output correctly shows values for every row & every field.
I assume that this is either something to do with escaping, or column storage, but how to handle it I am unsure ?
R:
LOAD * Inline [
rule; service; resource; formula
rle_xist_ProductID; athena; *; if(len(tag_ProductID)>0,'Y','N')
rle_xist_Name; athena; *; if(len(tag_Name)>0,'Y','N')
](delimiter is ';');
LET NumRows=NoOfRows('R');
FOR i=1 to $(NumRows)
LET vRle = FieldValue('rule', $(i));
LET vSvc = FieldValue('service', $(i));
LET vRsc = FieldValue('resource', $(i));
LET vFml = FieldValue('formula', $(i));
Trace '[] -------';
Trace '[] $(vRle)';
Trace '[] $(vSvc)';
Trace '[] $(vRsc)';
Trace '[] $(vFml)';
NEXT
Output
R << b8994efd-61b7-410b-9ebb-847463dea003
Lines fetched: 2
'[] -------'
'[] rle_xist_ProductID'
'[] athena'
'[] *'
'[] if(len(tag_ProductID)>0,''Y'',''N'')'
'[] -------'
'[] rle_xist_Name'
'[] '
'[] '
'[] if(len(tag_Name)>0,''Y'',''N'')'
Fieldvalue() is not the right function to use in this case, try using peek() instead, like:
FOR i=0 to $(NumRows)-1
LET vRle = Peek('rule', $(i));
LET vSvc = Peek('service', $(i));
LET vRsc = Peek('resource', $(i));
LET vFml = Peek('formula', $(i));
Trace '[] -------';
Trace '[] $(vRle)';
Trace '[] $(vSvc)';
Trace '[] $(vRsc)';
Trace '[] $(vFml)';
NEXT
Fieldvalue() is not the right function to use in this case, try using peek() instead, like:
FOR i=0 to $(NumRows)-1
LET vRle = Peek('rule', $(i));
LET vSvc = Peek('service', $(i));
LET vRsc = Peek('resource', $(i));
LET vFml = Peek('formula', $(i));
Trace '[] -------';
Trace '[] $(vRle)';
Trace '[] $(vSvc)';
Trace '[] $(vRsc)';
Trace '[] $(vFml)';
NEXT
Many thanks, that did the trick - looks like I need to brush up on some basics!
After that, I also note that iteration is zero-based index.