Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello everybody 🙂
i would generate a generic variable. is it possible to name the variable in step of a for next statement by the step?
VG
For me with QV 11.2 it worked. With another release the handling of fieldname() and/or with the quotes might have slightly changed and the workaround with evaluate() might be now unnecessary - are you sure that you took my code-snippet 1:1? If not there might be a small syntax-issue.
- Marcus
yes, I only changed the source. But I use Qlik Sense. does it matter?
The general workings should be the same but the release (of the engine) is surely different. I don't know if it's in your case worth to search for the cause - maybe it's just the legacy-mode or something similar - but I'm sure that these logic could be applied.
- Marcus
i have testet your script without the evaluate function.
the same Problem.
t1: first 1 LOAD * FROM [lib://OjO/OJO.XLSX](ooxml, embedded labels, table is OJO); t2: load peek('F') & '[' & fieldname(' & recno() & ', 't1') & ']' & if(recno() < nooffields('t1'), '&"|"&') as F autogenerate nooffields('t1');
to see what is in 'F'.
For me it worked:
Before going further just check if the normal fieldname() function itself worked, with:
fieldname(1, 't1')
if yes, try it with:
fieldname(recno(), 't1') and then with:
fieldname(evaluate(recno()), 't1') or fieldname(eavluate('recno()'), 't1')
and if this don't worked with:
evaluate('fieldname(' & recno() & ', ''t1'')')
whereby the exact use of the quotes is important. An alternatively to the last could be:
evaluate('fieldname(' & recno() & ',' & chr(39) & 't1' & chr(39) & ')')
- Marcus
fieldname(1, 't1') => works
fieldname(recno(), 't1') => works
fieldname(evaluate(recno()), 't1') => works
fieldname(evaluate('recno()'), 't1') => everything is NULL
evaluate('fieldname(' & recno() & ', ''t1'')') => every entry is "F"
evaluate('fieldname(' & recno() & ',' & chr(39) & 't1' & chr(39) & ')') => works
if I take the last way in your script in further steps i get an error.
This is the desired approach:
fieldname(recno(), 't1')
and everything else with the evaluate-stuff was just a workaround for a seemingly strange bug/feature in 11.2.
- Marcus
OK. But if I continue to use that is the error shown by me. what do I do about it?
But thank you in advance
Which error - the above one from the screenshot? If yes it meant that the record-check within field-concat - recno() vs. nooffields() - didn't work properly. Why I don't know - but could it be that Qlik tries to load a column with a blank fieldname (this happens if there is any content within any record of this column).
- Marcus
Yes, exactly this mistake. And yes, there is content in the columns. For each column, the program also does, for more than one column bicht. Is this due to a faulty understanding?