Fetching records from a table using a Business Function

Fedi

Member
Hi all,

I am trying to create a Business Function which fetches record from a standard table and populate it into my custom table. Using the table IO APIS it is possible to fetch records only with respect to the available indices of the table. But my fetch parameters are not with respect to available index.
Is there any other way I can fetch the records from the table, ie any APIS available for this or can I create an index with the result data structure within the business function.

Awaiting for your valuable reply,
 
Fedi,

Here's a little trick, when wanting to see how some of the more common C Syntax works....

If you can replicate your logic in a NER, you can review the C Code of that NER, for a better understanding. Within the NER, you can update the INDEX you want to use for a fetch. Then, look at the C Code to identify how the Syntax is written.

Note: The syntax that is written within a NER is USUALLY BLOATED C Code.... Meaning, it is not as streamlined as something that the most revered C Coders would provide to their customers.

Take a gander at the idea, and let us know if you need further assistance.

(db)
 
does it have to be in c? otherwise you could move it to a NER and use Select/FetchNext instead of a FetchSingle.

another possibility would be to add a custom index to the table, but this has some impact on performance i understood from cnc-folks.
 
[ QUOTE ]
Using the table IO APIS it is possible to fetch records only with respect to the available indices of the table.

[/ QUOTE ]

That statement is not true, which is a good thing. I can only assume you're referring to JDB_SelectKeyed to select records and specify a table index.

You can use achieve what you're trying to do by doing something along the lines of:

JDB_SetSelection(...) or JDB_SetSelectionX(...)
JDB_SelectKeyed( HREQUEST, 0,<font color="red">NULL </font>, 0 ); //notice use of NULL for key structure
JDB_Fetch( ... )

This essentially allows you to specify any data selection you want. I suggest looking at some existing code that uses JDB_SetSelection to see examples.

Good luck.
 
Hi All,

Thank you very much for your valuable replies. I proceeded with setSelection API and now i can select the records from the table with respect to my own index.

Thanks for your valuable time.
 
Back
Top