PDA

View Full Version : Add a Set to Control Panel


ABC123

jas
04-12-2008, 03:17 PM
Here’s my problem:
I've created 2 tables using tbl.duplicate()
then
I created a set using tbl.set_create()
Then
I added the 2 tables to the controlpanel using FILE_ADD_TO_DB()

The 2 tables were created using variables, say T1 and T2

The set was created using using the expression…T1+”_”+T2+”.set”
So that if T1=”abc” and T2= “def” then the set name is “abc_def.set”

All this has worked fine so far. Now I want to add the set to the controlpanel
using a variable :


For example:
set_name= T1+”_”+T2+”.set”
FILE_ADD_TO_DB(set_name)
I’ve tried several variations of this theme and just cannot get the set added to the controlpanel.

I also tried this in the interactive window:

?set_name
= "abc_def.set"

FILE_ADD_TO_DB("abc_def.set")

controlpanel.refresh()


I got no error, however the set was not added to the controlpanel. I guess my question is...Can a set be added to the controlpanel using xbasic and if so how??

I'm working in A5V9.

Thanks
Jim

jas
04-12-2008, 03:58 PM
I finally did it using the following syntax:

dim Myset as c
dim ptr as P
ptr = set.open(set_name)
Myset = ptr.filename_get()
file_add_to_db(table.filename_get(Myset))

which I actually borrowed from Graham Wickens post "Problem with IMPORT() function"

Thanks Graham!!

Jim Smith

MoGrace
04-12-2008, 04:47 PM
I was looking at the help file and noticed set.open_session() is needed if you are doing this from a form. Also don't forget to include set.close() when you are done!