Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm actually using Qlikview but couldn't find my usual forum board.
Not sure it matters though...
Lets say I have a table like this...
BrandCode | EventID | Last Login |
ABC | EF-123 | 16/10/2020 14:22:37 |
ABC | EF-123 | 26/06/2020 10:41:12 |
I need to rename the Last Login field as below so the field name contains the values from the BrandCode and EventID fields and has a datetime stamp at the end...
BrandCode
EventID
[Last Login] as 'Virtual_Event_Attendee_' & [BrandCode] & '_' & [EventID] & '_Last_Login_' & $(vTodaysDateTime)
The BrandCode & EventID will not change
It's ultimately for an export file that will feed into another system where they want a specific fieldname convention. Future tables of data will have different BrandCodes & EventIDs
Any ideas?
I tried using [...] around the as part too but no luck
vTodaysDateTime is like this...
LET vTodaysDateTime = Timestamp(Now(1),'DD-MMM-YYYY hh:mm:ss');
I don't think you're going to be able to achieve it in the script in the manner which you tried to use, though perhaps other people know ways to get it done. It seems you're trying to determine the column header based on data, but the data isn't read until the column header is determined as I understand it.
I would approach this by using Rename instead:
Load * Inline [
A, B, C
1, A, 100
1, A, 200
];
Let vName = FieldValue('A',1) & FieldValue('B',1) & Timestamp(Now(1),'DD-MMM-YYYY hh:mm:ss');
Rename Field [C] to '$(vName)';
It looks like you're trying to do this at the script level, but you should be doing it at the column level of the object. It should work assuming you indeed have a distinct value in the fields in question (for cleaner reading, I would use Only() for each one).
Thanks for reply
There aren't any objects - after various files are merged to produce that table in the script the data is going to be exported into a file for import into another system. Hence trying to do it in the script.
I don't think you're going to be able to achieve it in the script in the manner which you tried to use, though perhaps other people know ways to get it done. It seems you're trying to determine the column header based on data, but the data isn't read until the column header is determined as I understand it.
I would approach this by using Rename instead:
Load * Inline [
A, B, C
1, A, 100
1, A, 200
];
Let vName = FieldValue('A',1) & FieldValue('B',1) & Timestamp(Now(1),'DD-MMM-YYYY hh:mm:ss');
Rename Field [C] to '$(vName)';
Ah brilliant - works perfectly thank you