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
lookup(fieldname, matchfieldname, matchfieldvalue [, tablename])
Returns the value of fieldname corresponding to the first occurrence of the value matchfieldvalue in the field matchfieldname.
Fieldname, matchfieldname and tablename must be given as strings (e.g. quoted literals).
The search order is load order unless the table is the result of complex operations such as joins, in which case the order is not well defined.
Both fieldname and matchfieldname must be fields in the same table, specified by tablename. If tablename is omitted the current table is assumed.
If no match is found, null is returned.
Example:
lookup('Price', 'ProductID', InvoicedProd, 'pricelist')
Please close this discussion if you solved your problem adequately.
to use lookup, you would need to create a rowno() or some such field in the base table for your "i" variable to match against in the lookup.
Another option would be to use peek instead
hope that helps
Joe
duplicates are only in section field. So the remaining 3 fields may be used as lookup.
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
Hi All,
Thanks for all suggestions Peek function resolved issue:
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 = Peek('VariableName',$(i));
let $(vVariable) = Peek('Text',$(i));
NEXT i
Thanks
Neetha