Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am having issue with below code,it creates dynamic variables,but its assigning wrong text from next variable.
Help:
LOAD ChartName,
VariableName,
Text,
Section
FROM
[..\..\Source_Files\Bonus\Help\Text.QVD](qvd);
LET nRows = NoOfRows('Help')-1;
FOR i = 0 to $(nRows)
let vVariable = FieldValue('VariableName',$(i));
let $(vVariable) = FieldValue('Text',$(i));
NEXT i
Please any help will be appreciated
Thanks
Neetha
What I mean is, in order to do the required loop through, you need a value to use during each iteration of your lookup.
For this you would need a rowno to match against the i variable already created.
or create a concat list of 'VariableName' to for loop over.
Just pointing out you would need a bit of extra coding to use lookup that's all, where as peek could just be substituted in with ease to code already posted.
let vVariable = Peek('VariableName',$(i));
let $(vVariable) = Peek('Text',$(i));
Joe
most likely you have repeating values between rows
use lookup instead of fieldvalue
Note the Note
Returns the field value found in position n of the field fieldname (by load order). fieldname must be given as a string value, e.g. the field name must be enclosed by single quotes. The first field value is returned for n=1. If n is larger than the number of field values, NULL is returned.
Note: This function will only work with distinct field values.
Example:
FieldValue( 'HelpText', 5 )
Hi Ioannis,
all values are distinct in the file.
Thanks
Neetha
maybe in a row level
but not in field level. you have fields that have not unique values
post the file if possible
hi ioannis,
yes you are right section field has duplicates.
its not possible to upload file
Thanks
Neetha
Hi neetha,
Can you please tell what is the requirement ? because for the same variable your assigning two value one with text and one with variable name, so the combination may be unique but not the individual column elements . If that is the case try to build a composite key out of both and while extracting you can divide the composite key and use the variable
then you cannot use FieldValue. you need to use Lookup instead.
can anybody post any example of lookup
thanks