Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
Is there any way hide script in logs.
we are have set error mode=0 and set error mode=1, in between 0 and 1 we are using drop field statement at the end of script, we are finding field not found and which can be ignored that QV developers know but my production support team saying some error we found. so I need to hide that part.
Is there any way?
-Priya
Yes, just wrap a loop around it, like this ...
For each field in 'Data','Data2','Data4'
If FieldValueCount('$(field)')>=0 then
Drop Field $(field);
EndIf;
Next field;
flipside
EDIT: You might find it easier to store the desired fields to drop in a list as in this example ...
FieldsToDrop: //Note: it is dropping itself in the list!
Load
chr(39) & concat(FieldToDrop,chr(39) & ',' & chr(39)) & chr(39) as FieldToDrop
inline [
FieldToDrop
Data
Data2
Data4
FieldToDrop
];
let vFieldsToDrop = peek('FieldToDrop');
For each field in $(vFieldsToDrop)
If FieldValueCount('$(field)')>=0 then
Drop Field $(field);
EndIf;
Next field;
You can make hidden script. He is invisible in the reload log file.
https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/Hidden_Script.htm
You need to wrap a test around the DROP command ...
If NoOfRows('Test') >=0 then
Drop Table Test;
EndIf;
flipside
this hidden script will come first but my script at last of script
Hi Dave, can you pls elaborate pls.
Apologies, I put code up for testing a table rather than a field. In that case use this code ...
If FieldValueCount('Data')>=0 then
Drop Field Data;
EndIf;
This will test for the existence of the field before running the DROP command and generating the error message.
flipside
Thanks Dave, it can work for one field, but I have fields more than 50 columns. Can you pls share your ideas if you have.
-Thank you
Yes, just wrap a loop around it, like this ...
For each field in 'Data','Data2','Data4'
If FieldValueCount('$(field)')>=0 then
Drop Field $(field);
EndIf;
Next field;
flipside
EDIT: You might find it easier to store the desired fields to drop in a list as in this example ...
FieldsToDrop: //Note: it is dropping itself in the list!
Load
chr(39) & concat(FieldToDrop,chr(39) & ',' & chr(39)) & chr(39) as FieldToDrop
inline [
FieldToDrop
Data
Data2
Data4
FieldToDrop
];
let vFieldsToDrop = peek('FieldToDrop');
For each field in $(vFieldsToDrop)
If FieldValueCount('$(field)')>=0 then
Drop Field $(field);
EndIf;
Next field;