ExecuteSql question
ExecuteSQL ( "select sum(L.POInvAmt) from Ledger L where BudgetCategory= ?"; ""; ""; BudgetCategory)
I have BudgeCategory as Global. Now I have subCategory as global, how would I write or rather can I write...
select sum(L.PO..)....where BudgetCategory =? and subcategory =? ";"";"";BudgetCat , SubCat) or something similar?
I will try to make this a little more clear...
123 - a,a a,a a,a a, b,b,b,b,c,c,c,c,c,c
456 - a,a,a,a,b,b,b,b,c,c,c,c,c,c
123 and 456 are BC's a,b,c are SC's and I need sum of all a/b/c within 123 or 456 or watever.
Did this work when you tried it?
ExecuteSQL ( "select sum(L.POInvAmt) from Ledger L where BudgetCategory= ?and subcategory =? ";"";"";BudgetCat , SubCat)
Appears to be correct syntax provided that BudgetCategory and subcategory are both fields in Ledger and your "context" for this calculation is the table where BudgetCat and SubCat are defined as global variables. (Otherwise, you need a TableOcurrence::FieldName type reference for the two optional parameters at the end.)