Dynamic buffers [Archive] - ProgressTalk.com
Google
 
Web ProgressTalk.com

View Full Version : Dynamic buffers



brado
16 Feb 2005, 04:07 AM
I want to be able to do something like:

IF condition TRUE THEN
DEF BUFFER buf FOR sports.product.
ELSE
DEF BUFFER buf FOR newsports.product.

What is the exact progress commands to enable me create a dynamic buffer based on some condition i.e. to have the buffer buf pointing to either of the 2 DBs depending on the condition.

jongpau
16 Feb 2005, 03:28 PM
To do this truely dynamic try something like:
DEF VAR lhBuffer AS HANDLE NO-UNDO.
DEF VAR lvTable AS CHAR NO-UNDO.

IF condition
THEN lvTable = "First Table Name":U.
ELSE lvTable = "Second Table Name":U.

CREATE BUFFER lhBuffer FOR TABLE lvTable.With the above you willhave to use dynamic queries etc to access the buffer. Alternatively youcan create an alias for the databases and switch the alias based on thecondition. That way you can create the buffer for the aliased databasetable and use "normal" 4gl statements to access the buffer.

brado
21 Feb 2005, 09:50 AM
Thanks for that.

The second option would suit me better, how would I go about switching between the aliases and creating the buffers for the selected alias.