We have a custom Object, LE_WPP, which has multiple lines and a foreign key from its parent Object, LE_WPPAYMENTID. We also have an attribute called Linenum.
We will execute the attribute launch point when the foreign key (LE_WPPAYMENTID) inserts by default, when we click on the new row button.
Launch Point Type: Attribute
Object: LE_WPP
Attribute: LE_WPPAYMENTID (Foreign Key)
Script:
vWPPAYMENTID=mbo.getString('LE_WPPAYMENTID')
vWPP=mbo.getThisMboSet()
vWPP.setWhere("LE_WPPAYMENTID = "+ vWPPAYMENTID+"")
vWPP.setOrderBy("LE_PROGRESSID , LINENUM ");
#vcount=vWPP.count()
maxLineNum = 0
vWPP1=vWPP.moveFirst()
while vWPP1 is not None:
lineNum = vWPP1.getInt("LINENUM")
if lineNum > maxLineNum:
maxLineNum = lineNum
vWPP1=vWPP.moveNext()
nextLineNum = maxLineNum + 1
mbo.setValue("LINENUM", nextLineNum)
No comments:
Post a Comment