Topic
1 reply Latest Post - ‏2010-11-01T17:09:28Z by GeorgeMuhammad
GeorgeMuhammad
GeorgeMuhammad
9 Posts
ACCEPTED ANSWER

Pinned topic how to call a method (sql stored procedure db2) with arguments (inputs)

‏2010-10-28T16:10:35Z |
I am trying to call a method with Args from a Method builder.
Tried these two calls.
webAppAccess.callMethod("GetCostPriceWithArgs", cust, inum);
webAppAccess.callMethod("plookupconsumerGetCostPriceWithArgs", cust, inum);

Error Message:
**The error message returned was: "Error in method getPrices. Error in method transformResults2. Error in method GetCostPriceWithArgs. Method GetCostPriceWithArgs(java.lang.String "0246", java.lang.String "148627 ...") or GetCostPriceWithArgs(com.bowstreet.webapp.engine.WebAppAccessImpl, java.lang.String "0246", java.lang.String "148627 ...") not found in class genjava._priceLookupConsumer.".

SQL Call Builder:
{call storedprocedure( ?, ?)}
var1 name ${Variables/CostPriceSPInputs/CustID}
var2 name ${Variables/CostPriceSPInputs/Item}

WebApp Tree
/**
  • Generated Method plookupconsumerGetCostPriceWithArgs
*/
public IXml plookupconsumerGetCostPriceWithArgs(WebAppAccess webAppAccess, String arg1, String arg2, String arg3)
{
com.bowstreet.builderutilities.PageAutomationRuntime.assign(webAppAccess,"plookupconsumerGetCostPriceInputs/getCostPrice/CostPriceSPInputs", arg1, false );
com.bowstreet.builderutilities.PageAutomationRuntime.assign(webAppAccess,"plookupconsumerGetCostPriceInputs/getCostPrice/CostPriceSPInputs/CustID", arg2, false );
com.bowstreet.builderutilities.PageAutomationRuntime.assign(webAppAccess,"plookupconsumerGetCostPriceInputs/getCostPrice/CostPriceSPInputs/Item", arg3, false );
Object result = webAppAccess.callMethod("plookupconsumer.executeOperation", "getCostPrice", Boolean.TRUE );
if (result instanceof WebAppAccessConsumer) {
((WebAppAccessConsumer)result).setWebAppAccess(webAppAccess);
}
return (IXml)result;
}

My method code:
{
IXml source4 = webAppAccess.getVariables().getXml("plookupconsumerGetProductsByGenericCodeResults");
IXml target = webAppAccess.getVariables().getXml("results2");
target.removeChildren();

for(IXml item = source4.getFirstChildElement(); item != null; item =item.getNextSiblingElement())
{
// get CustID and item#
String cust = webAppAccess.getVariables().getString("custID");
String inum = item.getText("ICITEM");
//set custID and item# and call stored procedures
webAppAccess.callMethod("GetCostPriceWithArgs", cust, inum);
webAppAccess.callMethod("GetCPGTPRQWithArgs", cust, inum);
IXml item2 = webAppAccess.getVariables().getXml("plookupconsumerGetCPGTPRQResults");
IXml item3 = webAppAccess.getVariables().getXml("plookupconsumerGetCostPriceResults");
// set fields

String itemnum = item.getText("ICITEM");
String desc = item.getText("ICDSC1");
String size = item.getText("ICDSC2");
String uom = item.getText("ICSUM");
String ndc = item.getText("IC_NDC");
String upc = item.getText("ICUPC");
Updated on 2010-11-01T17:09:28Z at 2010-11-01T17:09:28Z by GeorgeMuhammad
  • GeorgeMuhammad
    GeorgeMuhammad
    9 Posts
    ACCEPTED ANSWER

    Re: how to call a method (sql stored procedure db2) with arguments (inputs)

    ‏2010-11-01T17:09:28Z  in response to GeorgeMuhammad
    I found the solution. Calling a method from a method builder.

    plookupconsumerGetCostPriceWithArgs(webAppAccess, "inputs", cust, icitem);
    plookupconsumerGetCPGTPRQWithArgs(webAppAccess, "inputs", cust, item.getText("ICITEM").trim());

    Even though there are only two parameters for the SQL call, the "inputs" parameter is required.