Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I am trying below script to pass field name into variables.
DataToReduce:
LOAD Item AS Item1,
Status AS Status1,
Store As Store1
FROM
Item.xlsx
(ooxml, embedded labels, table is DataToReduce);
let VNo.ofFields = NoOfFields('DataToReduce'); //To find No.of Fields in the table
for i=1to $(VNo.ofFields) //
let VFieldName=FieldName($(i),'DataToReduce'); //To find FieldName in the ith position.
FieldNames:
LOAD $(VFieldName) AutoGenerate 1;
next i;
output should be VFieldName=Item1,Status1,Store1.
But getting error like item1 field not found.
Can any one help on this issue.
Thanks in advance
That's because your dollar sign expansion will expand to something like
LOAD Item1, Status1, Store1
autogenerate 1;
But your data source (i,e, autogenerate 1) does not show these fields, and you are not aliasing them from an (e,g, constant) expression.
That's because your dollar sign expansion will expand to something like
LOAD Item1, Status1, Store1
autogenerate 1;
But your data source (i,e, autogenerate 1) does not show these fields, and you are not aliasing them from an (e,g, constant) expression.
can you explain that..
Do you expect to get
LOAD Item1, Status1, Store1
autogenerate 1;
when the variable expand or something else?
And if so, what do you expect to be the result of that LOAD statement? How should the resulting table look like?
Do you have any idea to store all field names into a variable.
Ex: var1=item1,Status1,Store1.
let VNo.ofFields = NoOfFields('DataToReduce'); //To find No.of Fields in the table
for i=1to $(VNo.ofFields) //
let VFieldName=FieldName($(i),'DataToReduce'); //To find FieldName in the ith position.
FieldNames:
LOAD $(i) as ID, '$(VFieldName)' as Field
AutoGenerate 1;
next i;
Fields:
LOAD CONCAT(Field,', ', ID) as Fields
RESIDENT FieldNames;
Let vFieldNames = Peek('Fields', 0,'Fields');
DROP TABLES Fields, FieldNames;
thankyou..so much its works..
Hi, I am having an error : Field '1' not found
What could be the solution for this ?