Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Hann
Partner - Contributor III
Partner - Contributor III

Alphabetical output

Hi,

 

I have a requirement to provide a qvd report. But if the first report generated the naming would be:

Report_Sales_20191122_A.qvd

Then if any time the report got any update and need to be generated again, the second time the same report generated would be:

Report_Sales_20191122_B.qvd

Until the maximum generated report is

Report_Sales_20191122_Z.qvd

 

Until it reach 'Z', the user will need to call the landlord. 

 

May I know how to do this. Because the report only generated if there is a update.

Labels (2)
4 Replies
Gopi_E
Creator II
Creator II

Hi  hann,

here you can achieve by using if() and right() functions

first you need to check coming data is update or not, so for that you need to check the condition 

if(<check update data here>, <if yes(generate qvd using right(change last character),)) 

Hann
Partner - Contributor III
Partner - Contributor III
Author

Hi, thanks but I think i need to use another table like below, then use counter for checking the most latest file, so i will need counter, then checking and naming based on the RepNo. 

image.png

Hann
Partner - Contributor III
Partner - Contributor III
Author

HI,

 

Currently, this is what i did. But i find it not practical and i also got an error message tho the file did load successfully.

 

LET vRepExistsA = not isnull(QVDCreateTime('[lib://N-Printing/Tender POS Data/TEST/RPT3_L214702_20191122_A.csv]'));
if $(vRepExistsA) = 0 then
Store SALE_RPT_FINAL into [lib://N-Printing/Tender POS Data/TEST/RPT3_$(vMachid)_$(vBusinessDate)_A.csv](txt, delimiter is ';');
else
LET vRepExistsB = NOT isnull(QVDCreateTime('[lib://N-Printing/Tender POS Data/TEST/RPT3_L214702_20191122_B.csv]'));
if $(vRepExistsB) = 0 then
Store SALE_RPT_FINAL into [lib://N-Printing/Tender POS Data/TEST/RPT3_$(vMachid)_$(vBusinessDate)_B.csv](txt, delimiter is ';');
end if
else
LET vRepExistsC = NOT isnull(QVDCreateTime('[lib://N-Printing/Tender POS Data/TEST/RPT3_L214702_20191122_C.csv]'));
if $(vRepExistsC) = 0 then
Store SALE_RPT_FINAL into [lib://N-Printing/Tender POS Data/TEST/RPT3_$(vMachid)_$(vBusinessDate)_C.csv](txt, delimiter is ';');
end if
else
LET vRepExistsD= NOT isnull(QVDCreateTime('[lib://N-Printing/Tender POS Data/TEST/RPT3_L214702_20191122_D.csv]'));
if $(vRepExistsD) = 0 then
Store SALE_RPT_FINAL into [lib://N-Printing/Tender POS Data/TEST/RPT3_$(vMachid)_$(vBusinessDate)_D.csv](txt, delimiter is ';');
end if
else
Store SALE_RPT_FINAL into [lib://N-Printing/Tender POS Data/TEST/RPT3_$(vMachid)_$(vBusinessDate)_E.csv](txt, delimiter is ';');
end if

marcus_sommer

You got an error because the order/syntax in your nested if-logic isn't correct - each single if must be directly closed with an end if and by using several conditions the new condition is applied with elseif, else is just optional to define any default value if none condition is true.

Beside this your approach to repeat the file-check is a possibility but I think it would be more suitable to use a loop for it instead of creating such amount of redundant script.

Maybe even better could be another approach which saved the file-name within a variable and checked then if there is any content and if it replaced the essential part just by counting 1 to the existing one (and a letter is also just a number). Here a simplified example what is meant:

if len(trim('$(var)')) then
   let var = mid('$(var)', 1, index('$(var)', -1)) & chr(ord(subfield('$(var)', '_', 4)) + 1);
else
   let var = 'YourInitialFileName';
end if

Just check the logic without loading/storing the data with a few TRACE statements if the multiple path-variables contain the right content and if it add 1 by each iteration of a reload.

- Marcus