Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
Not applicable

Error

Hi,

there is one variable vMaxDate  , which is created by taking first row from date field .

As the date field is blank so script is failing at Date > $(vMaxDate), but we want to ignore the TAB1 load on first TAb of script and move to second TAb and load Table2.

First TAb in script---

TAB1:

LOAD

RET,

Date,

Value

from Table1 where Date > $(vMaxDate);

Second TAb in script---


TAB2:

LOAD

RES,

Date,

Amt

from Table 2;

We can do it by SET ErrorMode = 0;

but is there any other way to do it or we want something like if $(vMaxDate) is null the SET ErrorMode = 0 else 1

Tags (2)
5 Replies

Re: Error

but is there any other way to do it or we want something like if $(vMaxDate) is null the SET ErrorMode = 0 else 1


From here, What was the condition seems this, But what the vMaxDate here simple Max(Date) or what?


If($(vMaxDate) = Null(), 0, 1) as ErrorMode

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

Re: Error

You can try with the following WHERE clause for TAB1 (add quotes)


:

from Table1 where Date > '$(vMaxDate)';

:


First time around, this code will load all rows. If that's not what you want, set the default value for vMaxDate to some exceptionally high date value that none of the available Dates will match.

Best,

Peter

Re: Error

Hi,

What you can do is put your script in if statement like below.

If not isnull($(vMaxDate)) then

Load from table 1

Else

Load from.table 2

End if

Regards,

Kaushik Solanki

sdmech81
Valued Contributor

Re: Error

Hi,

May be even if values in vmaxDate there or not and you want to run table 2 then You can try like this:

Here not adding anything btn else and end if bcs we don't want it to do anything If vmax Date id null..Plss Try and let me know.Hope it helps

If not isnull($(vMaxDate)) then

Load from table 1

Else

end if

Load from.table 2

sdmech81
Valued Contributor

Re: Error

And really avoiding error mode helps I guess bcs wt if it throws error bcs of some othr issue

Sachin