Var InvcDtl=(invcnum)=& gt; {
SQL. Connect (config). Then (()=& gt; {
. Return the SQL query ` select * from erp. InvcDtl
Where InvoiceNum=${invcnum} `
(}). Then the result=& gt; {
The console. Dir (result. You)
Var ProItems=[]
For (var value of the result. You)
The console. The log (
ItemsDtl={
Code: the value partNum,
Name: value. LineDesc,
Price: the value. The UnitPrice,
Quantity: value OurShipQty,
Uom: value -ium,
TaxRate: value taxRate,
Amount: the value DocExtPrice,
//commodity classification coding
//catalogCode: 'catalogCode - db,
},
ProItems. Push (ItemsDtl)
)
//throw ProItems
The console. The log (ProItems)
}). The catch (err=& gt; {
//... The error checks
})
SQL. On (' error 'err=& gt; {
//... The error handler
})
}
InvcDtl (19965)
CodePudding user response:
Warrior advice please, urgent urgent!CodePudding user response:
The var ProItems=[];Move to the
In the front of the SQL. Connect
Is actually a matter of the scope of the variable, so that you can use directly after the call methods ProItems
Or you where//throw ProItems to
Return ProItems//as a return value return
When call
Var res=InvcDtl (19965)