dear experts and members.. i am trying to create txt files based on inventory entries in purchase invoice.. I am able to achieve this but i am unable to clear the aggregate udf that i created ... so in next invoice all items of previous invoice also showing.. below is code.. need help regarding this Code: [#Form: Voucher] Add: Button: lbut [Button:lbut] Key : Alt+F12 Action: Call : loa Title : Labels Inactive: not @@IsPurchase [Report: labels] Form : labels Object : Company On: Load: Yes: Call: TestFunction123 [Form: labels] Part : FormSubTitle, labels FullWidth : No Width: 80% Screen Height : 90% Screen Background : @@SV_CHEQUE SpaceRight : 0.5 SpaceLeft : 1.5 Local : Field : Form SubTitle : Info : $$LocaleString:"Item Name / Barcode / MRP / Sale Rate / Code / Qty / Print" Option : Small Size Form On: Form Accept: Yes: Form Accept On: Form Accept: Yes: call : createtxt [Part: labels] Lines : labelsline Repeat : labelsline:mydbscheme1 Break on: $$IsEmpty:$ItemNameee Scroll : Vertical Height : 90% Screen [Line: labelsline] Fields : ItemName, Barcode, MRP, SaleRate, Code, Qty, Print Local : Field : Default : Delete : Border [Field: ItemName] Use : Name Field Storage: ItemNameee Width: 55% Screen [Field: Barcode] Use : Name Field Storage: Barcode Width: 10% Screen [Field: MRP] Use : Name Field Storage: MRP Width: 10% Screen [Field: SaleRate] Use : Name Field Storage: SaleRate Width: 10% Screen [Field: Code] Use : Name Field Storage: Code Width: 5% Screen [Field: Qty] Use : Name Field Storage: Qty Width: 5% Screen [Field: Print] Use : Logical Field Width: 5% Screen Storage: Print [System: Formula] nnumb: $VoucherNumber=#VchNumber [Variable: tempvar] Type: string [Collection: POSCOLL3] Type : Voucher Fetch : MasterId, Date, VoucherNumber, VoucherTypeName, LedgerEntries.* Filter : nnumb [Collection:labelcol] Source collection: POSCOLL3 Walk: Inventory Entries Fetch: StockItemName, PartNo, MRPRATE, INCLVATRATE, BilledQuantity, Rate, mystr, INCLUSIVETAXVALUE [Function : createtxt] 010 : WALK COLLECTION : mydbscheme1 011 : If: $Print = Yes 020 : Open File : "F:" + "\" + $ItemNameee + ".txt" : Text : Write 030 : Truncate File 031 : Write File Line : $ItemNameee 032 : Write File Line : $Barcode 033 : Write File Line : $MRP 034 : Write File Line : $MRP 035 : Write File Line : $Code 036 : Write File Line : $Qty 040 : CLOSE TARGET FILE 041 : End If 090 : END WALK [Function : TestFunction123] 11 : WALK COLLECTION : labelcol 20 : INSERT COLLECTION OBJECT : mydbscheme1 30 : Set Target : mydbscheme1 40 : Set Value : ItemNameee : $$String:$StockItemName 41 : Set Value : Barcode : $PartNo:StockItem:$StockItemName ;$$String:$MailingName:StockItem:$ItemNameee 42 : Set Value : MRP : $$String:$MRPRATE 43 : Set Value : SaleRate : $$String:$MRPRATE 44 : Set Value : Code : "" 45 : Set Value : Qty : $$String:$BilledQuantity 46 : Set Value : Print : Yes 60 : SET TARGET : .. 70 : END Walk 71 : Alter Target [Function: loa] Variable : vNum : Number ;10 : WALK : mydbscheme1 ; 30 : Set : vNum : $$NumItems:schemecollection ; ;40 : Set Target ; 41 : MSGBOX : "Status" : ##vNum ; 50 : WHILE : (##vNum > 0) ;60 : DELETE COLLECTION OBJECT : mydbscheme1 ; 70 : DECR : vNum ; 80 : END WHILE ; ;90 : Set Target : .. ; ;110 : END WALK 120 : Alter: labels [System: UDF] mydbscheme1 : Aggregate: 9988 ItemNameee : String : 9977 Barcode: String : 9976 MRP : String : 9975 SaleRate : String : 9974 Code : String : 9973 Qty : String : 9972 print : Logical: 9944
Try This... Code: [#Form: Voucher] Add: Button: lbut [Button:lbut] Key : Alt+F12 Action: Call : loa Title : Labels Inactive: not @@IsPurchase [Report: labels] Form : labels Object : Company On: Load: Yes: Call: TestFunction123 [Form: labels] Part : FormSubTitle, labels FullWidth : No Width: 80% Screen Height : 90% Screen Background : @@SV_CHEQUE SpaceRight : 0.5 SpaceLeft : 1.5 Local : Field : Form SubTitle : Info : $$LocaleString:"Item Name / Barcode / MRP / Sale Rate / Code / Qty / Print" Option : Small Size Form On: Form Accept: Yes: Form Accept On: Form Accept: Yes: call : createtxt [Part: labels] Lines : labelsline Repeat : labelsline:mydbscheme1 Break on: $$IsEmpty:$ItemNameee Scroll : Vertical Height : 90% Screen [Line: labelsline] Fields : ItemName, Barcode, MRP, SaleRate, Code, Qty, Print Local : Field : Default : Delete : Border [Field: ItemName] Use : Name Field Storage: ItemNameee Width: 55% Screen [Field: Barcode] Use : Name Field Storage: Barcode Width: 10% Screen [Field: MRP] Use : Name Field Storage: MRP Width: 10% Screen [Field: SaleRate] Use : Name Field Storage: SaleRate Width: 10% Screen [Field: Code] Use : Name Field Storage: Code Width: 5% Screen [Field: Qty] Use : Name Field Storage: Qty Width: 5% Screen [Field: Print] Use : Logical Field Width: 5% Screen Storage: Print [System: Formula] nnumb: $VoucherNumber=#VchNumber [Variable: tempvar] Type: string [Collection: POSCOLL3] Type : Voucher Fetch : MasterId, Date, VoucherNumber, VoucherTypeName, LedgerEntries.* Filter : nnumb [Collection:labelcol] Source collection: POSCOLL3 Walk: Inventory Entries Fetch: StockItemName, PartNo, MRPRATE, INCLVATRATE, BilledQuantity, Rate, mystr, INCLUSIVETAXVALUE [Function : createtxt] 010 : WALK COLLECTION : mydbscheme1 011 : If: $Print = Yes 020 : Open File : $ItemNameee + ".txt" : Text : Write ;"F:" + "\" + 030 : Truncate File 031 : Write File Line : $ItemNameee 032 : Write File Line : $Barcode 033 : Write File Line : $MRP 034 : Write File Line : $MRP 035 : Write File Line : $Code 036 : Write File Line : $Qty 040 : CLOSE TARGET FILE 041 : End If 090 : END WALK 092 : Call : Test Function [Function : TestFunction123] 11 : WALK COLLECTION : labelcol 20 : INSERT COLLECTION OBJECT : mydbscheme1 30 : Set Target : mydbscheme1 40 : Set Value : ItemNameee : $$String:$StockItemName 41 : Set Value : Barcode : $PartNo:StockItem:$StockItemName ;$$String:$MailingName:StockItem:$ItemNameee 42 : Set Value : MRP : $$String:$MRPRATE 43 : Set Value : SaleRate : $$String:$MRPRATE 44 : Set Value : Code : "" 45 : Set Value : Qty : $$String:$BilledQuantity 46 : Set Value : Print : Yes 60 : SET TARGET : .. 70 : END Walk 71 : Alter Target [Function: loa] Variable : NumItems : Number ;10 : WALK : mydbscheme1 ; 30 : Set : vNum : $$NumItems:schemecollection ; ;40 : Set Target ; 41 : MSGBOX : "Status" : ##vNum ; 50 : WHILE : (##vNum > 0) ;60 : DELETE COLLECTION OBJECT : mydbscheme1 ; 70 : DECR : vNum ; 80 : END WHILE ; ;90 : Set Target : .. ; ;110 : END WALK ; 051 : Set : NumItems : $$NumItems:mydbscheme1 ; ; 071 : WHILE : ##NumItems > 0 ; 072 : DELETE COLLECTION OBJECT : mydbscheme1 : 1 : Yes ; 073 : DECR: NumItems ; 074 : END WHILE ; 075 : Accept Alter ; 076 : Return 120 : Alter: labels ; 250 : Set Target:(Company,##SVCurrentCompany). [Function : Test Function] Variable :NumItems:Number 251 : Set : NumItems : $$NumItems:mydbscheme1 ;252 : Log : ##NumItems 271 : WHILE : ##NumItems > 0 272 : DELETE COLLECTION OBJECT : mydbscheme1 : 1 : Yes 273 : DECR: NumItems 274 : END WHILE 275 : Accept Alter ; 076 : Return [System: UDF] mydbscheme1 : Aggregate: 9988 ItemNameee : String : 9977 Barcode: String : 9976 MRP : String : 9975 SaleRate : String : 9974 Code : String : 9973 Qty : String : 9972 print : Logical: 9944