Skip to main content

Hello team - very new to Amprscript and not much of a tech person ---  in the logic below, only the %%[IF @itemline == 0 THEN]%% is resolving.. I'm not getting anything for when @itemline == 1 or @itemline == 2

Also, how can I mange the script for values of @itemline from zero (0) to lets say a 1000.. I don't want to generate 1000 IF statements.. Thanks for you help on this..

 

%%[

var @docEntry, @itemline, @itemdescription, @item_price, @quantity, @UCX

set @docEntry = Lookup("OINV","DocEntry","CardCode",_subscriberKey)

set @itemline = Lookup("INV1","LineNum","DocEntry",@docEntry)

set @itemdescription = Lookup("INV1","Dscription","DocEntry",@docEntry)

set @quantity = Lookup("INV1","Quantity","DocEntry",@docEntry)

set @item_price = Lookup("INV1","Price","DocEntry",@docEntry)

]%%

%%[IF @itemline == 0 THEN]%%  

            <tr class="item">

                <td>

                

%%=Lookup("INV1","Dscription","DocEntry",@docEntry,"LineNum",0)=%%

<br/>

  </td>

  <td>%%=Lookup("INV1","Quantity","DocEntry",@docEntry,"LineNum",0)=%%</td>

                

                <td>

                    %%=Lookup("INV1","Price","DocEntry",@docEntry,"LineNum",0)=%%

                </td>

            </tr>         

%%[ENDIF]%%

            

<--END CODE>

<--INSERT CODE>

            

%%[IF @itemline == 1 THEN]%%  

            <tr class="item">

                <td>

                

%%=Lookup("INV1","Dscription","DocEntry",@docEntry,"LineNum",1)=%%

<br/>

  </td>

  <td>%%=Lookup("INV1","Quantity","DocEntry",@docEntry,"LineNum",1)=%%</td>

                

                <td>

                    %%=Lookup("INV1","Price","DocEntry",@docEntry,"LineNum",1)=%%

                </td>

            </tr>         

%%[ENDIF]%%

            

<--END CODE>

<--INSERT CODE>

            

%%[IF @itemline == 2 THEN]%%  

            <tr class="item">

                <td>

                

%%=Lookup("INV1","Dscription","DocEntry",@docEntry,"LineNum",2)=%%

<br/>

  </td>

  <td>%%=Lookup("INV1","Quantity","DocEntry",@docEntry,"LineNum",2)=%%</td>

                

                <td>

                    %%=Lookup("INV1","Price","DocEntry",@docEntry,"LineNum",2)=%%

                </td>

            </tr>         

%%[ENDIF]%%

0/9000