Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Looping through a qvd

Good afternoon,

I am trying to code the following portion of pseudo code into a Qlik script but am not having any luck

  1. If Total Rebate Accum = 0
    1. New member paid = original member paid
    2. New plan paid = original plan paid
    3. New Rx Deductible = new member paid
    4. New Blend Deductible = Med Deduct + New Rx Deductible
  2. If Total Rebate Accum > 0 and accum blend deduct < Ind_deductible
    1. New member Paid = total cost – Total rebate
    2. New Plan Paid = total Cost – New member Paid
    3. New Rx Deductible = new member paid
    4. New Blend Deductible = Med Deduct + New Rx Deductible

My attempt using a do while yielded no new fields as output:

Do while Rebate_Dollars = 0
LOAD
*,
[Clm Apprv Mem Paid] as Org_Mem_Paid,
[Clm Apprv Gross Due Amt] as Org_Plan_Paid,
[Clm Deduct Amt] as New_Mem_Paid,
MED_DEDUCT + [Clm Deduct Amt] as New_Blend_Ded,
LOOP
resident
ACCUMPREP;

My attempt using nested if then else logic from post on Qlik Community. Obviously not correct based on syntax errors I see in editor.

CLAIMS1:
LOAD
*,
if(Rebate_Dollars = 0,{
[Clm Apprv Mem Paid] as Org_Mem_Paid,
[Clm Apprv Gross Due Amt] as Org_Plan_Paid,
[Clm Deduct Amt] as New_Mem_Paid,
MED_DEDUCT + [Clm Deduct Amt] as New_Blend_Ded});
elseif Rebate_Dollars
= 0
resident ACCUMPREP;

My attempt using sub routine in an if statement.

 

CLAIMS1:
LOAD
*,
if(Rebate_Dollars = 0,
call
ZeroRebates (Org_Mem_Paid, Org_Plan_Paid, New_Mem_Paid, New_Blend_Ded))
resident ACCUMPREP;

sub ZeroRebates (Org_Mem_Paid,Org_Plan_Paid,New_Mem_Paid,New_Blend_Ded)
Org_Mem_Paid = [Clm Apprv Mem Paid]
Org_Plan_Paid = [Clm Apprv Gross Due Amt]
New_Mem_Paid = [Clm Deduct Amt]
New_Blend_Ded = MED_DEDUCT + [Clm Deduct Amt]
endsub

If someone has any suggestions on how this logic would best be coded I would be greatful.

Thanks

S.

0 Replies