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: 
vchuprina
Specialist
Specialist

Subfield issue

I try to use following script, but it return issue. Subfield function doesn't work, it seems that string is too long. Did somebody had similar problem. Please advise how you resolve it

++++++++++++++++++++++++++++++++++++++++

ODBC CONNECT32 TO [Excel Files;DBQ=$(vFile)];

  // Read list of sheets

  Temp_Tables:

  sqltables;

Temp1:

LOAD Concat(DISTINCT TABLE_NAME, '|') as Concat,

          Count(DISTINCT TABLE_NAME) as Count

Resident Temp_Tables;

LET vConcat = Chr(39) & Peek('Concat') & Chr(39);

LET vCount = Peek('Count');

DROP Tables Temp1, Temp_Tables;

DISCONNECT;

  // Get just the file name

  let vFileName = mid(vFile, index(vFile, '\', -1) + 1);

  // Enumerate sheets

  for iSheet = 1 to $(vCount)

  let vSheetName = SubField($(vConcat), '|', $(iSheet));

  let vSheetName = replace(replace(replace(vSheetName, chr(39), ''), chr(36),''),'#','.')

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Script line error:

let vSheetName = SubField (''BA Detail$'FilterDatabase|'BA Detail$'Print_Titles|'BA Summary$'Print_Titles|'F16 Detail$'|'F16 Detail$'FilterDatabase|'F16 Detail$'Print_Titles|'F16 Summary$'|'F16 Summary$'Print_Titles|'Prior Detail$'FilterDatabase|'Prior Detail$'Print_Titles|'SPIN Data$'FilterDatabase|'Total Recap$'FilterDatabase|'Total Recap$'Print_Area|'Total Recap$'Print_Titles', '|', 1)

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
4 Replies
m_woolf
Master II
Master II

The apostrophes are problematic.

swuehl
MVP
MVP

I think it's not the length of the string, but the quoting.

Have you considered instead of using concat() / subfield() to just peek() the TABLE_NAME from Temp_Tables in your loop?

vchuprina
Specialist
Specialist
Author

I've added replace function, but it still not works

Replace(Concat(DISTINCT TABLE_NAME, '|'),chr(39),'') as Concat

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
vchuprina
Specialist
Specialist
Author

I tried do this, but had the same result

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").