Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil1989
Contributor
Contributor

Field Value to fetch the record??

Hi ,

Thanks in advance!!!

i am new to the qlik , this is my below script , for first row its work fine but when its go to the second row its able to fetch TableName(store_pick.Refunds ) but not able to fetch remaning row . please see below i have added log file can anyone please help me on this.

LIST_OF_TABLES:

LOAD * INLINE [

TableName,LoadType,StartDate,EndDate

store_pick.Payments,0,20170426,20170427

store_pick.Refunds,0,20170426,20170427

];

FOR i=1 to FieldValueCount('TableName')

LET vTableName = FieldValue('TableName',$(i)) ;

trace $(vTableName);

LET vLoadType = FieldValue('LoadType',$(i)) ;

trace $(vLoadType);

LET vStartDate = FieldValue('StartDate',$(i)) ;

trace $(vStartDate);

LET vEndDate = FieldValue('EndDate',$(i)) ;

trace $(vEndDate);

NEXT i

LOG FILE  ::

02/05/2017 07:19:17: 0030  LIST_OF_TABLES:

02/05/2017 07:19:17: 0031  LOAD * INLINE [

02/05/2017 07:19:17: 0032  TableName,LoadType,StartDate,EndDate

02/05/2017 07:19:17: 0033  store_pick.Payments,0,20170426,20170427

02/05/2017 07:19:17: 0034  store_pick.Refunds,0,20170426,20170427

02/05/2017 07:19:17: 0035  ]

02/05/2017 07:19:17:       4 fields found: TableName, LoadType, StartDate, EndDate, 2 lines fetched

02/05/2017 07:19:17: 0044  FOR i=1 to FieldValueCount('TableName')

02/05/2017 07:19:17: 0045    LET vTableName = FieldValue('TableName',1)

02/05/2017 07:19:17: 0046    trace store_pick.Payments

02/05/2017 07:19:17: 0046    store_pick.Payments

02/05/2017 07:19:17: 0047    LET vLoadType = FieldValue('LoadType',1)

02/05/2017 07:19:17: 0048    trace 0

02/05/2017 07:19:17: 0048    0

02/05/2017 07:19:17: 0050    LET vStartDate = FieldValue('StartDate',1)

02/05/2017 07:19:17: 0053    trace 20170426

02/05/2017 07:19:17: 0053    20170426

02/05/2017 07:19:17: 0054    LET vEndDate = FieldValue('EndDate',1)

02/05/2017 07:19:17: 0055    trace 20170427

02/05/2017 07:19:17: 0055    20170427

02/05/2017 07:19:17: 0093  NEXT i

02/05/2017 07:19:17: 0045    LET vTableName = FieldValue('TableName',2)

02/05/2017 07:19:17: 0046    trace store_pick.Refunds

02/05/2017 07:19:17: 0046    store_pick.Refunds

02/05/2017 07:19:17: 0047    LET vLoadType = FieldValue('LoadType',2)

02/05/2017 07:19:17: 0048    trace

02/05/2017 07:19:17: 0048   

02/05/2017 07:19:17: 0050    LET vStartDate = FieldValue('StartDate',2)

02/05/2017 07:19:17: 0053    trace

02/05/2017 07:19:17: 0053   

02/05/2017 07:19:17: 0054    LET vEndDate = FieldValue('EndDate',2)

02/05/2017 07:19:17: 0055    trace

02/05/2017 07:19:17: 0055   

02/05/2017 07:19:17: 0093  NEXT i

02/05/2017 07:19:18:      Execution finished.

1 Solution

Accepted Solutions
PrashantSangle

Hi,

Your code is working fine.

If you have distinct data then only you can trace it else It will not trace 2nd occurrence.

update your table with below data and observe all possibility.

LOAD * INLINE [

TableName,LoadType,StartDate,EndDate

store_pick.Payments,0,20170426,20170427

store_pick.Refunds,1,20170426,20170428

];

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

2 Replies
PrashantSangle

Hi,

Your code is working fine.

If you have distinct data then only you can trace it else It will not trace 2nd occurrence.

update your table with below data and observe all possibility.

LOAD * INLINE [

TableName,LoadType,StartDate,EndDate

store_pick.Payments,0,20170426,20170427

store_pick.Refunds,1,20170426,20170428

];

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunil1989
Contributor
Contributor
Author

Thanks for reply ,

I have used Peek function instead of fieldvalue , its working fine.