Import table names and perform a search.

prashanth

New Member
I have an input Excel file which contains some table names.

After importing, how do I do a query on it.

Ex:If have to do a for each on the table.

Value-of, value etc, does not seem to work.


Progress Version : 10.2b
 
You can not use variable table and field names in static FOR EACH or QUERY constructs. These are resolved at compile time and that is why you get a syntax error.

If the table name must be resolved at run time you need to use dynamic buffer and dynamic query objects. These have been introduced more than 10 years ago with Progress V9.

Heavy Regards, RealHeavyDude.
 
You can not use variable table and field names in static FOR EACH or QUERY constructs. These are resolved at compile time and that is why you get a syntax error.

If the table name must be resolved at run time you need to use dynamic buffer and dynamic query objects. These have been introduced more than 10 years ago with Progress V9.

Heavy Regards, RealHeavyDude.


I am new to progress!!!

Can you please let me know how to solve the above problem using dynamic queries?

Thanks in advance.
 
Time to read the help files etc. We're not here to do your job for you I'm afraid. There is a wealth of information here on this forum that you can use as well as examples in the helpfiles.
 
No matter how new you are to Progress, if you have no experience with dynamic handle-based objects then you are entering risky territory when relying just on samples. The dynamic handle-based objects are easy to master but they are a completely different thing than the static references. You need to make yourself familiar with them because otherwise chances are very high that you produce memory leaks and inconsistent behavior.

Nevertheless ( coded in Firefox IDE - therefore not syntax checked ...):
Code:
 DEFINE VARIABLE bufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE queryHandle AS HANDLE NO-UNDO.

/* Create the dynamic objects */
CREATE BUFFER bufferHandle FOR TABLE "myTableName".
CREATE QUERY queryHandle.
queryHandle:SET-BUFFERS ( bufferHandle ).

/* Prepare and open the query */
queryHandle:QUERY-PREPARE ( SUBSTITUTE ( "FOR EACH &1 NO-LOCK", bufferHandle:NAME ) ).
queryHandle:QUERY-OPEN ( ).

/* Loop through the result set */
queryHandle:GET-FIRST ( NO-LOCK ).
DO WHILE NOT queryHandle:QUERY-OFF-END:
  /* Do your stuff */
  queryHandle:GET-NEXT ( NO-LOCK ).
END.
queryHandle:QUERY-CLOSE ( ).

/* Cleanup so that we don't produce a memory leak */
DELETE OBJECT queryHandle.
DELETE OBJECT bufferHandle.

Heavy Regards, RealHeavyDude.
 
Back
Top