Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Champion III
Champion 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

1 Solution

Accepted Solutions
Highlighted
Employee
Employee

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

View solution in original post

12 Replies
Highlighted
Employee
Employee

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

View solution in original post

Highlighted
Champion III
Champion III

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

Highlighted

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

would you mind testing my solution and giving feedback?

Highlighted

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)
Highlighted
Champion III
Champion III

your way it works but that i dont need clever 

Highlighted
Champion III
Champion III

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

Highlighted

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)
Highlighted
Champion III
Champion III

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 .