I have a transaction like this
And I have a web panel using Work With Plus to insert data into the transaction
I want to auto number the attribute TmpltId
based on the SalOutCd7Plc
and BseCd
like this:
Example:
SalOutCd7Plc = 1 and BseCd = 1 -> TmpltId = 1 then continue if SalOutCd7Plc = 1 and BseCd = 1 -> TmpltId = 2
But if SalOutCd7Plc = 1 and BseCd = 2 -> TmpltId = 1 and continue
If SalOutCd7Plc = 2 and BseCd = 1 -> TmpltId = 1 and continue
Something like that. How can I achieve this. Thank you
To autonumber the attribute TmpltId you may create a procedure with the following:
Rules:
parm(in:&SENSY0470M_SalOutCd7Plc,in:&SENSY0470M_BseCd,out:&SENSY0470M_TmpltId);
Source:
For each SENSY0470M order SENSY0470M_SalOutCd7Plc SENSY0470M_BseCd (SENSY0470M_TmpltId)
where SENSY0470M_SalOutCd7Plc = &SENSY0470M_SalOutCd7Plc
where SENSY0470M_BseCd = &SENSY0470M_BseCd
&SENSY0470M_TmpltId = SENSY0470M_TmpltId + 1
exit
when none
&SENSY0470M_TmpltId = 1
EndFor
Then, in your web panel before inserting you can call the procedure to get the new SENSY0470M_TmpltId
&NEW_SENSY0470M_TmpltId = Procedure.Udp(&SENSY0470M_SalOutCd7Plc, &SENSY0470M_BseCd)