Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Chanty4u
Esteemed Contributor III

RE:Pass to Variable

Hi all,

i want to pass the  field into a variable

below is my code

let vVar=  If(MonthStart(OrderDate)= MonthStart(Today(1)),1,0);   /// this one

sample:

LOAD

    Product,

    "Year",

    "Month",

    "OrderDate",

    If(MonthStart(OrderDate)= MonthStart(Today(1)),1,0) as CurrentMonth,     

    Sales

FROM [lib://Data/sample.xlsx]

(ooxml, embedded labels, table is Sheet1);

same i passed to variable but its not working   any other way to achieve this?

i want to compare if   data is available for current month display 1 orelse 0

thanks

Chanty

Tags (2)
1 Solution

Accepted Solutions
Employee
Employee

Re: RE:Pass to Variable

SET vVar=  If(MonthStart(OrderDate)= MonthStart(Today(1)),1,0);   /// this one

sample:

LOAD

    Product,

    "Year",

    "Month",

    "OrderDate",

    $(vVar) as CurrentMonth,    

    Sales

FROM [lib://Data/sample.xlsx]

(ooxml, embedded labels, table is Sheet1);

12 Replies
Employee
Employee

Re: RE:Pass to Variable

SET vVar=  If(MonthStart(OrderDate)= MonthStart(Today(1)),1,0);   /// this one

sample:

LOAD

    Product,

    "Year",

    "Month",

    "OrderDate",

    $(vVar) as CurrentMonth,    

    Sales

FROM [lib://Data/sample.xlsx]

(ooxml, embedded labels, table is Sheet1);

Chanty4u
Esteemed Contributor III

Re: RE:Pass to Variable

thanks clever

the script which i am using giving me correct but the variable is not working

but the variable result am getting null as a field it is giving me correct.

but i want the variable to use in Nprinting

Re: RE:Pass to Variable

Seems working with SET rather LET

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)
Employee
Employee

Re: RE:Pass to Variable

would you mind testing my solution and giving feedback?

Re: RE:Pass to Variable

Seems working in field too

LET vVar=  If(MonthStart(OrderDate)= MonthStart(Today(1)),1,0);

LOAD *,If(MonthStart(OrderDate)= MonthStart(Today(1)),1,0) as CurrentMonth Inline [

Product, Year, Month, OrderDate, Sales

A, 2017, 1, 12/1/2017, 10

B, 2016, 5, 12/10/2016, 20

C, 2015, 10, 10/10/2015, 30

];

LOAD * Inline [

FieldName

'$(vVar)'

];

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)
Chanty4u
Esteemed Contributor III

Re: RE:Pass to Variable

your way it works but that i dont need clever 

Chanty4u
Esteemed Contributor III

Re: RE:Pass to Variable

yes anil its working  but  same variable am giving as a condition in npritning it is not working

Re: RE:Pass to Variable

I don't even what is N-Printing. May be i am going to kick that.. Not sure how to call in N-Printing.

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)
Chanty4u
Esteemed Contributor III

Re: RE:Pass to Variable

there will be one option like condition there we can pass qlik variable

so now am passing above variable  like when my report having latest month data the report should send to customer  or else it should not send 

this is my requirement.    now the variable is working but when i test in nprinting the report is not generating even though current month data is there .