Is there any way to pass parameter in selection query for a database provider.
for example I want to the query:
Select field1 from tablename where field1=<Parameter>
How I will pass the parameter to the database provider?
Please help on the above question.
I nead to obtain a value from a table within a function body.
customerName is a string.
customerId is a string.
getCustomerName function will fetch the customer value from database table.
How I will do that?
Your two posts actually ask two different questions. So, I will give short answers to both. First, when using a database provider, set up the provider first and ensure it is accessing your table. Then when you select the provider with a Value Holder, you will need to override the provider with the values you wish to pass using the parameters that can be added in the override. The SQL statement can also be overridden if desired. Place a "?" where the parameter will go in the SQL and then place the parameters in the correct order.
The second question you asked was how to access the database in a function. Is this a template function? If so, use the technique above to create a value holder to substitute into the function. If this is not a template function, then you can't use a database provider. You will need to import the BOM for the database and then it can be accessed using the business object model methods. As part of the setup of the BOM, the query can be created and the bound parameters defined. This is all in the help pages.
I have created a JDBC Model
this has created the table class
now I want to query the table using selectionOptions, how is this accomplished
I want help with the syntax
and this should fetch a single or array of records, how is this done
maybe I am answering my own questions
but here is how I have done it
1 create Database Model class with Params, this creates a Table Class and Params class
2 declare object of type Params
3 set values to the Params object ParamsObject.variable1= 123 etc
4 then call
call setParams on TableClass using TableParams;call fetchAllInstances on TableClass;
Retrieving data ...