Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In the load script I would like to add a new column which check 4 columns to see if there is a value or an empty value, if value in all 4 columns, then “ready” is added in the row, if no value in 1 of the 4 columns then “not ready”
Hi Kirsten,
Something like this should work:
LOAD
...
IF(len(trim(F1)) * len(trim(F2)) * len(trim(F3)) * len(trim(F4)) > 0, 'Ready', 'Not Ready') as Status,
...
If any of the fields is empty, then len(trim()) will return 0 and the whole expression is zero. When all fields are filled up, then the multiplication of the 4 lengths will produce a non-zero result.
To learn more advanced development techniques, check out the agenda of the Masters Summit for Qlik - coming soon to Orlando and to Dublin!
Kirsten,
in the formula that you attached in the PDF document, there are more opening parentheses than closing parentheses, and that causes a syntax error. Count your parentheses and correct the formula.
I spotted unnecessary parentheses before the second and the third function len - those need to be removed. Then, look for any other syntax issues and make sure that you have the same number of opening and closing parentheses and that they are placed logically.
Hi Kristen,
it seems that you are trying to sum over the Status field. Please try the count function.
E.g. count([SAP.SAPSFMSstatusSalesOrder])
Kind regards from Brussels,
Thilo
Hi @KirstenKa ,
you are doing sum of text? and you are looking for count of records.
So, instead of SUM() use count()
Regards,
Prashant Sangle
Hi Kirsten,
As the other guys suggested, you should be counting the statuses using the function count().
Cheers,
It works thanks
Hi Kirsten,
Something like this should work:
LOAD
...
IF(len(trim(F1)) * len(trim(F2)) * len(trim(F3)) * len(trim(F4)) > 0, 'Ready', 'Not Ready') as Status,
...
If any of the fields is empty, then len(trim()) will return 0 and the whole expression is zero. When all fields are filled up, then the multiplication of the 4 lengths will produce a non-zero result.
To learn more advanced development techniques, check out the agenda of the Masters Summit for Qlik - coming soon to Orlando and to Dublin!
Thanks, how to integrate this in the load script? If I add it like above it gives an error, see attachment
You are missing a comma in the previous line (1101).
Thanks. See attachment: Comma’s is helping a bit but still not completely, I added 1 after “Vol. Unit” and 1 after “Sales order” Can this be related to that the different columns have different values, so >0 can not be used for all? I assume I should use a different formula’s for each column
Values in code:
Values not in code yet, due to bracket issue -> code doesn't accept value due to bracket or - in code:
@KirstenKa Please see the code below:
NoConcatenate
Temp:
Load * Inline [
A,B,C,D
1,5,9,13,
2,6,10,14
,7,11,15
4,8,12,
];
NoConcatenate
Temp1:
Load *,
if(not isnull(emptyisnull(A)) and Not isnull(emptyisnull(B)) and
not isnull(emptyisnull(C)) and not isnull(emptyisnull(D)),'Ready','Not Ready')
as Status
Resident Temp;
Drop table Temp;
Exit Script;
If this resolves your issue, please like and accept it as a solution.
Thanks but in this code I do not see how to relate it to the columns and do not know where the numbers stand for. Is A, B, C, D columns?
and no concatenate temp should be above the load script ? Or full script should be under original Load?
Kirsten,
in the formula that you attached in the PDF document, there are more opening parentheses than closing parentheses, and that causes a syntax error. Count your parentheses and correct the formula.
I spotted unnecessary parentheses before the second and the third function len - those need to be removed. Then, look for any other syntax issues and make sure that you have the same number of opening and closing parentheses and that they are placed logically.
Thanks it works now I removed the parenthesis as you mentioned and the comma at the end. Though I need to see if the end result in the column is now correct because I see some strange numbers in my graph. Will do some investigation and will let you know, once correct I will accept it as a solution.
@Oleg_Troyansky the script now works and I can load the data. When I look directly in the datasource itself I see "ready" statuses are generated in the column. However when I make a graph I see zero results. Is there something wrong with how I make the graph? (See attachment) Or should different expressions being used in the script since I have different data per column, see below