Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
andrea0901
Creator
Creator

Logic needed in qlikview

Hi all,

Please help me out . I have written the code as below: just an sample code.

In my first tab, i am using a binary load, and in that QVW my table name is ABCD.

In my second tab doing some transformations taking the resident of ABCD, below is the code:   

temp1:

Load *,

Applymap('T1',CC) as Test1,

if(P1= 'No', IF(ApplyMap('T2',CC)<=R1,'ICC','SAP'),If(ApplyMap('T3',CC)<=R1,'ICC','SAP')) as Live,

if((T4='MR1M' and LEFT(P1,1)<>3)OR (P2='BAPI_OCR'AND P1='BAPI_OCR'),'Automatic','NotAutomatic') as Autoposted

Resident ABCD;

drop table ABCD;

Store temp1 into temp1.qvd(qvd);

Temp2:

NoConcatenate

Load P1,

Test1,

Live,

Autoposted

Resident temp1 ;

drop table temp1;

 

 

My problem here is : 

in temp2 table i have added all the column names from temp1 table. Now i have to add a new logic to Live field whcih i have mentioned in temp1 table.

 

The logic is : when Autoposted = Automatic and P1 = BAPI_OCR' and P2 = BAPI_OCR' then my Live  field should show "ICC" otherwise "SAP". 

if i add this logic in temp1 autoposted i am deriving with som logic so i am unable to use Autposted field. 

Please help me out to include the logic.

7 Replies
albert_guito
Creator II
Creator II

Hi, just to clarify me where do you want to see the new logic condition in temp1 or in temp2?
Ag+
andrea0901
Creator
Creator
Author

i need the new logic in temp2 table.

albert_guito
Creator II
Creator II

Temp2:
NoConcatenate
Load
P1,
Test1,
If ( Autoposted ='Automatic' and P1 = 'BAPI_OCR' and P2 = 'BAPI_OCR'
,'ICC'
,'SAP'
) as Live,
Autoposted
Resident temp1 ;

Is not running well for you?
Ag+
anushree1
Specialist II
Specialist II

But you have already written the transformation on Live Column  in Temp 1 like this:

if(P1= 'No', IF(ApplyMap('T2',CC)<=R1,'ICC','SAP'),If(ApplyMap('T3',CC)<=R1,'ICC','SAP')) as Live,

so do you not want this transformation to apply and would like to overwrite Live with new logic?

andrea0901
Creator
Creator
Author

yes, u r correct.  i need the logic to be same in temp1 and top of this i need to add the logic . But if i add in temp1 the new logic, i need to have Autoposted field which i am calculating Autposted in temp1.

So i cant write the logic in temp1.

albert_guito
Creator II
Creator II

In this case you have to use a precedent load in temp1 but original Live not make sense because it will be replaced.

I've replace the label as tmp_Live to not loose these field.

temp1:

Load *, If ( Autoposted ='Automatic' and P1 = 'BAPI_OCR' and P2 = 'BAPI_OCR','ICC','SAP') as Live;
Load *,
Applymap('T1',CC) as Test1,
if(P1= 'No', IF(ApplyMap('T2',CC)<=R1,'ICC','SAP'),If(ApplyMap('T3',CC)<=R1,'ICC','SAP')) as tmp_Live,
if((T4='MR1M' and LEFT(P1,1)<>3)OR (P2='BAPI_OCR'AND P1='BAPI_OCR'),'Automatic','NotAutomatic') as Autoposted
Resident ABCD;

drop table ABCD;

Store temp1 into temp1.qvd(qvd);
Ag+
andrea0901
Creator
Creator
Author

The below code is not working as Autoposted field is not found. we cant do preceding load on this.  Is there anyway to solve this issue.