Dear All TDL Experts, I have tried to import standard price for stock items through exel sheet. But my code is not working, it is showing execution failed. I have attached the code. please do the need full. Thanks in advance. thanking you,
Code: [Function : Asspricexecelimportmain] Variable : Assstdpriceexcelpath : String 010 : Alter : Assexcelpathireport 020 : If : $$Lastresult 030 : call : AssitempricelistimportA 040 : EndIF [#Menu : Gatewayoftally] Item : Price List Import : Call : Asspricexecelimportmain [Report : Assexcelpathireport] Title : $$Localestring:"Excel Sheet Path" Form : Assexcelpathireport Object : company [Form : Assexcelpathireport] Part : Assexcelpathireport height : 7% Page Width : 40% Page [Part : Assexcelpathireport] Line : Assexcelpathireport [Line : Assexcelpathireport] Field : Mediumprompt, Assexcelpathireport Local : Field : Mediumprompt : Info : "Excel Sheet file Pateh" [Field : Assexcelpathireport] Use : Name Field Modifies : Assstdpriceexcelpath Width : 30% Page Max : 100 ;;======================================================================================================================================== [System : Formula] AssitemexcelFilepath:##Assstdpriceexcelpath [Collection : Assexcelsheetcoll] ODBC : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + @@AssitemexcelFilepath SQL : "Select * from [Sheet1$]" SQLObject : AssexcelsheetObj [Object : AssexcelsheetObj] AssItemName : $_1 AsspriceDate : $_2 AssPriceamt : $_3 ;;============================================================================================================================================== [Function : AssitempricelistimportA] Variable : MyitemName : String 10 : IF : NOT ($$NumItems:Assexcelsheetcoll> 0) 20 : RETURN 30 : END IF 100 : Walk Collection : Assexcelsheetcoll 110 : Set : MyitemName : $AssItemName 120 : Call : AssitempricelistimportB 130 : End Walk 140 : MSGBox : "Status": "Process Done!!!" [Function : AssitempricelistimportB] Variable : VarRate : String 90 : New Object : stockitem : ##MyitemName : Yes 111 : Insert collection object :StandardPriceList 112 : Set Value : Date : $$VCSSAP_DateFormat:$AsspriceDate 113 : SET : VarRate : $$String:$AssPriceamt 114 : Set Value : Rate : $$TgtObject:$$AsRate:##VarRate 130 : Accept Alter ;;------------------------------------------------------------------------------------------------------------------------------------------------ [Function: VCSSAP_DateFormat] Parameter : VDate : String Variable : UniqueExport : String 001 : If : $$StringLength:##VDate>10 002 : SET : UniqueExport : $$StringPart:##VDate:8:2 + "/" + $$StringPart:##VDate:5:2 + "/"+ $$StringPart:##VDate:0:4 003 : Else 004 : SET : UniqueExport : ##VDate 005 : End If 006 : RETURN : ##UniqueExport Date Format Should be : DD/MM/YYYY
Code: [Function : Asspricexecelimportmain] Variable : Assstdpriceexcelpath : String 010 : Alter : Assexcelpathireport 020 : If : $$Lastresult 030 : call : AssitempricelistimportA 040 : EndIF [#Menu : Gatewayoftally] Item : Price List Import : Call : Asspricexecelimportmain [Report : Assexcelpathireport] Title : $$Localestring:"Excel Sheet Path" Form : Assexcelpathireport Object : company [Form : Assexcelpathireport] Part : Assexcelpathireport height : 7% Page Width : 40% Page [Part : Assexcelpathireport] Line : Assexcelpathireport [Line : Assexcelpathireport] Field : Mediumprompt, Assexcelpathireport Local : Field : Mediumprompt : Info : "Excel Sheet file Pateh" [Field : Assexcelpathireport] Use : Name Field Modifies : Assstdpriceexcelpath Width : 30% Page Max : 100 ;;======================================================================================================================================== [System : Formula] AssitemexcelFilepath:##Assstdpriceexcelpath [Collection : Assexcelsheetcoll] ODBC : "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + @@AssitemexcelFilepath SQL : "Select * from [Sheet1$]" SQLObject : AssexcelsheetObj [Object : AssexcelsheetObj] AssItemName : $_1 AsspriceDate : $_2 AssPriceamt : $_3 ;;============================================================================================================================================== [Function : AssitempricelistimportA] Variable : MyitemName : String 10 : IF : NOT ($$NumItems:Assexcelsheetcoll> 0) 20 : RETURN 30 : END IF 100 : Walk Collection : Assexcelsheetcoll 110 : Set : MyitemName : $AssItemName 120 : Call : AssitempricelistimportB 130 : End Walk 140 : MSGBox : "Status": "Process Done!!!" [Function : AssitempricelistimportB] Variable : VarRate : String 90 : New Object : stockitem : ##MyitemName : Yes 111 : Insert collection object :StandardPriceList 112 : Set Value : Date : $$VCSSAP_DateFormat:$AsspriceDate 113 : SET : VarRate : $$String:$AssPriceamt 114 : Set Value : Rate : $$TgtObject:$$AsRate:##VarRate 130 : Accept Alter ;;------------------------------------------------------------------------------------------------------------------------------------------------ [Function: VCSSAP_DateFormat] Parameter : VDate : String Variable : UniqueExport : String 001 : If : $$StringLength:##VDate>10 002 : SET : UniqueExport : $$StringPart:##VDate:8:2 + "/" + $$StringPart:##VDate:5:2 + "/"+ $$StringPart:##VDate:0:4 003 : Else 004 : SET : UniqueExport : ##VDate 005 : End If 006 : RETURN : ##UniqueExport Date Format Should be : DD/MM/YYYY