Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
vvira1316
Specialist II
Specialist II

LOAD INLINE is not working as intended

I'm creating table using following

String_Positions:
LOAD * INLINE [
    Change Number, StringNum, StringDesc
]
;

I've to assign values to field using following assignments

LET CHG_NUM = Peek('Change Number', $(i), 'AllCRs');

For one Change Number there can be multiple Apporval History information that I'm splitting from a field of previously loaded table and assigning it to following variables.

LET StringLen = $(EndPos) - $(BegPos) + 1;
LET StringDesc = Chr(39) & trim(Peek('Approval history', $(i), 'AllCRs')) & Chr(39);
LET StringDesc = Chr(39) & Mid(trim($(StringDesc)), $(BegPos), $(StringLen)) & Chr(39);

I've to insert above information into a table that I can use later for visualization.

Concatenate(String_Positions)
LOAD Distinct [Change Number], StringNum, StringDesc INLINE [ Change Number, StringNum, StringDesc
$(CHG_NUM) as Change Number,$(StringNum) as StringNum, $(StringDesc) as StringDesc]
;

I'm looping through for all records of AllCRs.

Issue I'm running into is that I'm getting improper assignment or NULL values into String Positions table. Please advise what is wrong here.

Thanks,

Vijay

1 Solution

Accepted Solutions
Nicole-Smith

Concatenate(String_Positions)
LOAD Distinct '$(CHG_NUM)' as [Change Number],

              '$(StringNum)' as StringNum,

              '$(StringDesc)' as StringDesc

autogenerate 1;

View solution in original post

11 Replies
Nicole-Smith

I don't think you need the inline load:

Concatenate(String_Positions)
LOAD Distinct $(CHG_NUM) as [Change Number],

              $(StringNum) as StringNum,

              $(StringDesc) as StringDesc

autogenerate 1;


I'm also guessing you already have a for loop around this since you're using $(i).  You will need some kind of loop if you don't already have one.

hic
Former Employee
Former Employee

You shouldn't use inline load here. Instead you should use a For Next loop, maybe the following:

For i = 0 to NoOfRows()

  LET StringLen = $(EndPos) - $(BegPos) + 1;

  LET StringDesc = Chr(39) & trim(Peek('Approval history', $(i), 'AllCRs')) & Chr(39);

  LET StringDesc = Chr(39) & Mid(trim($(StringDesc)), $(BegPos), $(StringLen)) & Chr(39);

  Load

  Peek('Change Number', $(i), 'AllCRs'),

  '$(StringNum)' as StringNum,

  '$(StringDesc)' as StringDesc

  Autogenerate 1;

Next i

HIC

preminqlik
Specialist II
Specialist II

everything is looking fine which filed you are getting null values?

vvira1316
Specialist II
Specialist II
Author

Thanks for a prompt response.

I've used Autogenerate 1 as suggested but getting error. I'm attaching the screen shot.

Load_Error.JPG.jpg

Nicole-Smith

Concatenate(String_Positions)
LOAD Distinct '$(CHG_NUM)' as [Change Number],

              '$(StringNum)' as StringNum,

              '$(StringDesc)' as StringDesc

autogenerate 1;

preminqlik
Specialist II
Specialist II

'$(CHG_NUM)' as [Change Number],


vvira1316
Specialist II
Specialist II
Author

Hi Nicole,

I tried that and it also throws error. I'm attaching the screen shot.

Load_Error2.JPG.jpg

Thanks,

Vijay

Nicole-Smith

One more time:

Concatenate(String_Positions)
LOAD Distinct '$(CHG_NUM)' as [Change Number],

              '$(StringNum)' as StringNum,

              $(StringDesc) as StringDesc

autogenerate 1;

vvira1316
Specialist II
Specialist II
Author

Hi,

It worked with following syntax.

Concatenate(String_Positions)
LOAD Distinct '$(CHG_NUM)' as [Change Number],

              $(StringNum) as StringNum,

              $(StringDesc) as StringDesc

autogenerate 1;

Now I'm getting value for Change Number from String Positions table but other two values are coming NULL even though at assignment time those variables have proper values.

Any ideas?

Thanks,

Vijay