Save Collection Data into Aggregate UDF

Discussion in 'Requests' started by Naitesh, Sep 6, 2018.

    
  1. Naitesh

    Naitesh Member


    please help me to Save Collection Data into Aggregate UDF
    I Wrote Code but something wrong

    Thank You Sir

    [System: UDF]
    MyUdfStkMasterTBL : Aggregate : 20010
    MyUdfStkItemName : String : 20011

    [#Menu: Accounts Info.]
    Add: Item :Before :mad:@locQuit:Stock Item Master:Alter:Stock Detail Master
    Add: Item :Before :mad:@locQuit:Import Stock Item Master:Call : TestFunction123

    [Report:Stock Detail Master]
    Form: STForm
    Title: "Stock Detail Master"
    Object:company

    [Form: STForm]
    Width: 100% Screen
    Height: 100% Screen
    Background: FormClr
    Part:STPart

    [Part:STPart ]
    Line: STLineTitle,STLine
    Repeat:STLine:MyUdfStkMasterTBL
    Break on : $$IsEmpty:$MyUdfStkItemName
    Scroll: Vertical

    [Line:STLineTitle]
    Fields : TLSTSrNoFld, TLSTNameFld
    Local : Field : Default : Delete : Border

    [Line:STLine]
    Fields : Multi SNo, STNameFld
    Local : Field : Default : Delete : Border

    [Field: TLSTSrNoFld]
    Use: Name Field
    Set as: "Sr"
    Width: 4
    Align: Center
    Color: BLUE

    [Field: TLSTNameFld]
    Use: Name Field
    Set as: "Stock Name"
    Width: 30
    Align: Left
    Color: BLUE

    [Field: STNameFld]
    Use : Name Field
    Storage : MyUdfStkItemName
    Unique : Yes
    Width: 30

    [Collection : CollMaster123]
    Type : Vouchers : Stock Item
    Child Of : $$BaseOwner:#VchStockItem

    [Collection : CollDetails123]
    Source Collection : CollMaster123
    Walk : Inventory Entries
    By : StockItemName : $StockItemName
    Fetch :StockItemName

    [Function : TestFunction123]
    10 : WALK COLLECTION : CollDetails123
    20 : INSERT COLLECTION OBJECT : MyUdfStkMasterTBL
    30 : Set Target : MyUdfStkMasterTBL
    40 : Set Value : MyUdfStkItemName : $$String:$StockItemName
    60 : SET TARGET : ..
    70 : END Walk
    80 : Accept Create
    90 : Return
    100: MSGBOX : "Status" : "Stock Item-Type Imported"
     

    Attached Files:



  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Your function order was wrong.... here is the correct function.....

    [Function : TestFunction123]
    10 : WALK COLLECTION : CollDetails123
    20 : INSERT COLLECTION OBJECT : MyUdfStkMasterTBL
    30 : Set Target : MyUdfStkMasterTBL
    40 : Set Value : MyUdfStkItemName : $$String:$StockItemName
    60 : SET TARGET : ..
    70 : Create Target
    80 : END Walk
    100: MSGBOX : "Status" : "Stock Item-Type Imported"
    110 : Return
     


  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    If the function of this FUNCTION is to create StockItem, why is your collection based on VOUCHERS ????

    If in Vocuhers, means Stock Item already exists, else you would not be able to pass any entries, THEN WHAT exactly is being imported???
     
    Jaydeep Shah likes this.


  4. Naitesh

    Naitesh Member


    thank you sir for reply
    i have created udf field stockcolor in sales voucher after stockitem
    i want to save stockitem and stockcolor to this Aggregate field from all inventory entries

    [System: UDF]
    MyUdfStkMasterTBL : Aggregate : 20010
    MyUdfStkItemName : String : 20011
    MyUdfStkItemColor : String : 20012

    [#Menu: Accounts Info.]
    Add: Item :Before :mad:@locQuit:Stock Item Master:Alter:Stock Detail Master
    Add: Item :Before :mad:@locQuit:Import Stock Item Master:Call : TestFunction123

    [Report:Stock Detail Master]
    Form: STForm
    Title: "Stock Detail Master"
    Object:company

    [Form: STForm]
    Width: 100% Screen
    Height: 100% Screen
    Background: FormClr
    Part:STPart

    [Part:STPart ]
    Line: STLineTitle,STLine
    Repeat:STLine:MyUdfStkMasterTBL
    Break on : $$IsEmpty:$MyUdfStkItemName
    Scroll: Vertical

    [Line:STLineTitle]
    Fields : TLSTSrNoFld, TLSTNameFld,TLSTColor
    Local : Field : Default : Delete : Border

    [Line:STLine]
    Fields : Multi SNo, STNameFld,STColorFld
    Local : Field : Default : Delete : Border

    [Field: TLSTSrNoFld]
    Use: Name Field
    Set as: "Sr"
    Width: 4
    Align: Center
    Color: BLUE

    [Field: TLSTNameFld]
    Use: Name Field
    Set as: "Stock Name"
    Width: 30
    Align: Left
    Color: BLUE

    [Field: STNameFld]
    Use : Name Field
    Storage : MyUdfStkItemName
    Unique : Yes
    Width: 30

    [Field: TLSTColor]
    Use: Name Field
    Set as: "Stock Color"
    Width: 30
    Align: Left
    Color: BLUE

    [Field: STColorFld]
    Use : Name Field
    Storage : MyUdfStkItemColor
    Unique : Yes
    Width: 30

    [Collection : CollMaster123]
    Type : Vouchers : Stock Item
    Child Of : $$BaseOwner:#VchStockItem

    [Collection : CollDetails123]
    Source Collection : CollMaster123
    Walk : Inventory Entries
    By : StockItemName : $StockItemName
    By : MyStockColor : $MyStockColor
    Fetch :StockItemName,MyStockColor

    [Function : TestFunction123]
    10 : WALK COLLECTION : CollDetails123
    20 : INSERT COLLECTION OBJECT : MyUdfStkMasterTBL
    30 : Set Target : MyUdfStkMasterTBL
    40 : Set Value : MyUdfStkItemName : $$String:$StockItemName
    50 : Set Value : MyUdfStkItemColor : $$String:$MyStockColor
    60 : SET TARGET : ..
    70 : END Walk
    80 : Accept Create
    90 : Return
    100: MSGBOX : "Status" : "Stock Item-Type Imported"
     

    Attached Files:



Share This Page