Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to interrupt reload and throw error if field is empty?

Hello.

I load data from excel files and I want to interrupt reload and throw error if some of column cell is empty.

Some ideas?

4 Replies
Not applicable
Author

this dont throw error:

load
if(len(column1)=0, 1/0, column1) as Column1
from ......


Not applicable
Author

Hi,

In order to interrupt script execution you can use "exit script".
With the trace statement you can write error messages into log file and script execution progress window.

Alex

Not applicable
Author

I haven't found a command to throw exceptions but instead i use a dummy call to a sub that does not exist:

if someError then
     call ThrowException('Error: some kind of error');  // the sub doesn't exist ==> qv error
end if

This will propagate an error back to the publisher and report the task as failed. If sometime in the future qliktech will implement a (or I learn how of) way to throw exceptions, for instance by letting us set "ScriptError", then it is easy to create the sub ThrowException to use that feature.

Anonymous
Not applicable
Author

load

   if(len(column1)=0, 'error', '') as event   // this won't pickup null values.

..

..

let idxevent=FieldIndex('event','error');

if idxevent>0 then

       error:

       load

        a

       from 'field is zero'(qvd); // should be a non existing file.

endif