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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic column name

Hello everybody.

 

I have a table with a timestamp field. Processing the data, I am recovering the HOUR value from this field.

I have also another table with fields like: hour_0, hour_1... hour_23.

 

My question is: is there any way of converting the calculated hour from timestamp into the target column in order to insert a value? For instance, if the hour is 13 then I want to insert the new value in hour_13 from the final table.

 

I am pretty new using TOD and this is driving me crazy. Could you please help me?

Thanks in advance.

Labels (2)
2 Replies
akumar2301
Specialist II
Specialist II

Many ways to achive this.

1)Put the calculated hour in globalvar e.g calculatedHour
2)tfixedflowinput , put schema same as table i.e. all hour column
3) in expression ,
Hour-0
If ( (global get function for calculatedHour )=0) then inputtimestamp else “”

Hour1

If ( (global get function for calculatedHour )=1) then inputtimestamp else “”
and so on.
above Syntax is not correct , but i hope you got the idea.



Anonymous
Not applicable
Author

Thanks for your response, but I think I did not explain the problem properly, sorry, I will try it again:

 

I have a table with several rows. In every row there is a timestamp refering to an hour of a day and a value:

ID:01 - 2020/01/01 00:00 - VAL000

ID:02 - 2020/01/01 01:00 - VAL001

ID:03 - 2020/01/01 02:00 - VAL002

... (and so on)

 

I also have another table in which I have to insert the value from each hour in a column for this hour. The table is like:

ID - YEAR - MONTH- DAY - HOUR_0 - HOUR_1 - HOUR_2 ... HOUR_23

 

I need to manage data in order to insert:

1 - 2020 - 01 - 01 - VAL000 - VAL001 - VAL002 - VAL003...

 

I mean, I try to "convert" several rows in columns, more or less.

 

I hope now it is better explained. 

Thanks.