I'm not very familiar with SQL, but enjoy using it to modify tables and add 
fields.
I’m in the process of using JotForm as an intake device into a database. Its a 
very quick, fairly flexible, easy to use web form solution to gather data from 
web users. There is an API that eventually would allow importation of the data 
into 4D directly. Right now in this testing mode, I’m exporting the data from 
JotForm to cvs       format and importing that into 4D.

The form has 68 fields.
I wanted to create the table JotForm using SQL in 4D, managed that without 
problems, and added text fields into the table. Naming is simple JT_001, JT-002 
etc 68 times

As I said I created the table with SQL.  I haven't create the fields yet.

So I know that using something like
Begin SQL
ALTER TABLE JotForm ADD JT_001 TEXT NOT NULL;
ALTER TABLE JotForm ADD JT_002 TEXT NOT NULL;
ALTER TABLE JotForm ADD JT_003 TEXT NOT NULL 
End SQL

etc repeat 68 time would do the job

But I rather, since I’m trying to learn more, be more elegant -
something like

For($a;1;68)
Case of
:($a<10)
vfname:=“JT-00”+string($a)
Begin SQL
ALTER TABLE JotForm ADD vfname TEXT NOT NULL
End SQL
:($a>9)
vfname:=“JT-0”+string($a)
Begin SQL
ALTER TABLE JotForm ADD vfname TEXT NOT NULL
End SQL
end case
end for

Of course this doesn’t quite work. All the 68 fields would be named vfname.

How do I get the 4D variable into a sql variable that would be recognized by 
the Alter table command?

Thanks
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to