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: 
qlikviewforum
Creator II
Creator II

Issue in getting the column value in the For loop using the Variable

I am trying fetch value in NewC in similar way like NewB in the RANGE table but is always blank. Not sure what could the reason. Am I missing something very silly here.

Is it because i am using the square[] bracket here? Please suggest

Temp:
Load A,B,[C C]
FROM Source;

Let vNoRows = NoOfRows('Temp');

FOR i=0 to $(vNoRows)

Let vA=peek('A',$(i),'Temp');
let vB= peek('B',$(i),'Temp');
let vC= peek('[C C]',$(i),'Temp');

RANGE:
load distinct
  PERIOD as Dates,
     '$(vB)' as NewB,
        '$(vC)' as NewC
resident FACT_ALL_PERIOD
WHERE f_PERIOD <='$(vDateLessthan)'
;


  concatenate(_RANGE)
  load distinct
   BUSINESS_DATE AS Dates,
   '$(vB)' as NewB,
            '$(vC)' as NewC
  FROM [..\..\..\QVD\EMP\EMP.qvd](qvd)
  where TRIM(Date(DATE,'MM/DD/YYYY')) <='$(vDateLessthan)'
  and TRIM(B) = '$(vB)'
  ;
//END IF;

NEXT

drop table Temp;

1 Solution

Accepted Solutions
maxgro
MVP
MVP

Remove the [ ]

Temp:

Load 'a' as A, 'b' as B, 'c' as [C C] AutoGenerate 1;

Load 'aa' as A, 'bb' as B, 'cc' as [C C] AutoGenerate 1;

Load 'aaa' as A, 'bbb' as B, 'ccc' as [C C] AutoGenerate 1;

Let vNoRows = NoOfRows('Temp');

FOR i=0 to $(vNoRows)

  Let vA=peek('A',$(i),'Temp');

  let vB= peek('B',$(i),'Temp');

  let vC= peek('C C',$(i),'Temp');

  trace $(vA) $(vB) $(vC);

NEXT

View solution in original post

1 Reply
maxgro
MVP
MVP

Remove the [ ]

Temp:

Load 'a' as A, 'b' as B, 'c' as [C C] AutoGenerate 1;

Load 'aa' as A, 'bb' as B, 'cc' as [C C] AutoGenerate 1;

Load 'aaa' as A, 'bbb' as B, 'ccc' as [C C] AutoGenerate 1;

Let vNoRows = NoOfRows('Temp');

FOR i=0 to $(vNoRows)

  Let vA=peek('A',$(i),'Temp');

  let vB= peek('B',$(i),'Temp');

  let vC= peek('C C',$(i),'Temp');

  trace $(vA) $(vB) $(vC);

NEXT