Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankTheTank
Contributor III
Contributor III

a dynamic variable

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

23 Replies
marcus_sommer

Then more logic would be needed - maybe something in this way:

t2:
   load peek('F') &
   if(len(trim(fieldname(recno(), 't1'))) >= 1,
       '[' & fieldname(recno(), 't1') & ']' & if(recno() < nooffields('t1'), '&''|''&'), '') as F
autogenerate nooffields('t1');

- Marcus

FrankTheTank
Contributor III
Contributor III
Author

in this code 

'&''|''&'), '') 

are this two single ' quotas or double quotas?
 

marcus_sommer

It are two single-quotes but you could replace it with chr(39) - in one example above there was such approach.

- Marcus

FrankTheTank
Contributor III
Contributor III
Author

It now seems to work with it. I will again check if identical lines get the same hash value.
If so, then I should be at the goal of my idea.

 

t1:
LOAD 
*
FROM [lib://OjO/OJO.XLSX](ooxml, embedded labels, table is OJO);


t2:
load peek('F') &
	'[' &
fieldname(recno(), 't1')
	& ']' & 
    if(recno() < nooffields('t1'),
	'&' & chr(39) & '|' & chr(39) & '&')
    as F
autogenerate nooffields('t1');

let h = peek('F', -1, 't2');
drop tables t1, t2;


t3:
load recno() as RecNo, *, hash256($(h)) as Hash, autonumberhash256($(h)) as Autonumberhash
FROM [lib://OjO/OJO.XLSX](ooxml, embedded labels, table is OJO);