Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
harleen_singh
Creator III
Creator III

calling orderdate into 2nd table from first table

Hello,

          i am writing this code

        Load

       orderdate, A, B,C from table1

Load

if(IsNull(EndDate),max(orderdate),EndDate) as EndDate,

StartDate,

TerritoryID From

Table2

the above code gives error?? how to solve it?

thanks
Lavi

1 Solution

Accepted Solutions
harleen_singh
Creator III
Creator III
Author

Lukasarn,

             i have done by creating Temporary table

Temp:

LOAD

num(max(OrderDate)) as MaxDate

Resident Table1;

LET vMaxDate = peek('MaxDate', 0, 'TEMP');

Drop Table Temp;

Now i can use this variable VMaxDate any where.

thanks for your kind help

Regards
Lavi

View solution in original post

10 Replies
Not applicable

Hello lavi,

i think you have to map the orderdate in table2

than you can write:

Load

       if(IsNull(EndDate),max(orderdate),EndDate) as EndDate,

       *;

Load

      (mapping orderdate) ,

     EndDate,

     StartDate,

     TerritoryID

From

Table2


harleen_singh
Creator III
Creator III
Author

Lukasarn,

             thanks for response,

              

but u have loaded this statement

if(IsNull(EndDate),max(orderdate),EndDate) as EndDate

in first table. but i am loading this statement in second table.

and also

Load  (mapping orderdate) format is not correct i guess Mapping Load is correct.

thanks
Lavi

Not applicable

Do the tables have a relation?

table1:

Load

     orderdate,

     A,

     B,

     C

from

table1;

Mappingtable:

Mapping Load ......

table2:

Load

       if(IsNull(EndDate),max(orderdate),EndDate) as EndDate,

       *;

Load

     apply map .... ,

     EndDate,

     StartDate,

     TerritoryID

From

Table2

of course (mapping orderdate) is not the right syntax ,it should only show you where you have to write it.


SunilChauhan
Champion II
Champion II

hello sardar ji,

post a clear requirement what u want

Sunil Chauhan
harleen_singh
Creator III
Creator III
Author

lukasarn

no table does not have any relation.

and what to write after apply map .... ,  in your answer??

thanks

Lavi

harleen_singh
Creator III
Creator III
Author

lukasarn,

               can i store max(orderdate) in variable and then use it on other table??

thanks
Lavi

SunilChauhan
Champion II
Champion II

hello lavi ,

now u are on right track u can store it into variable and use anywhere u want .

Sunil Chauhan
its_anandrjs
Champion III
Champion III

Hi,

Yes you are able to put Max(orderdate) in variable like vOrderVar = Max(orderdate) and where ever you use in the application you are able to use it.

Regards

Anand

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try this.

     Table1:   

      Load

           orderdate, A, B,C

      from table1;

     Temp:

     Load Max(orderdate) as Max

     Resident Table1;

  

     Let vMax =  peek('Max',0,'Temp');

     Drop table Temp;

     Table2:

     Load

         if(IsNull(EndDate),$(vMax),EndDate) as EndDate,

          StartDate,

          TerritoryID

    From Table2

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!