Try with the FieldName function
And store it in a variable. Maybe will bes necessary load twice each table, one for get the field name (you can read only one row) and other for load the data (with the new values from the variable)
that's great! I've seen that function before and it'll probably do the trick.
I have bigger issues understanding how to load the table to insert the variables (containing the field name) in the correct column. It would be great if you could give an example of how that is done, and also specifically how to insert it in all four rows.
You can try this
First 1 LOAD * FROM APICall; //You load only one row to get the names
LET vDateRow = subfield(FieldName(3, 'FieldNames'), '_', 4); //To get the date
Drop Table FieldNames;
$(vDateRow) AS Date
Probably you must to do some changes to this script, but I think is a good approach to the solution.
Exactly what I needed, thank you!
Small issues keep occurring... Now there seems to be an issue with the dates.
I have the date 2017-05-03 and this is exactly what is read into vDateRow, but it doesn't stay that way when loaded into the table. I've tried several different ways but I can't seem to get it right.
LET vDateRow = subfield(FieldName(3, 'steps'),'_',4); (where vDateRow == 2017-05-03)
Date($(vDateRow)) AS week_date,
$(vDateRow) AS week_date_2,
[event] as [event_community],
[count] AS [count_community]
WHERE NOT IsNull([__FK_steps]);
So the issue is that the real date is 2017-05-03 but it shows up as something completely different.