` Simple SELECT builder (Juanro) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

SQL Related Articles: Simple SELECT builder
2004-04-19 -- Juanro
 
Newsgroups: softvelocity.clarion.databasedrivers Have you ever seen something like this? Test FILE(...) Record Field1 LONG Field2 LONG Desc STRING END Test{PROP:SQL} = 'SELECT Desc FROM Test WHERE ...' !error: invalid character value ... Do you have a file with a correct ...PROP:SQL = 'SELECT ...' and then you changed the file structure and "BANG!" ? (I was. Many times ) Since then I'm using this (see below) I guess many of you could have something similar, but anyway, here it is. Hope you find it usefull, best regards, Juanro ---------------------------------------------------------------------------- -------------------------------- BuildSelectList PROCEDURE (FILE ThisTable) ! Declare Procedure LOC:StrLine STRING(10000) ! CODE LOC:StrLine = '' count# = 1 LOOP f#=1 TO ThisTable{PROP:Fields} IF ThisTable{PROP:Type,f#}<>'GROUP' LOC:StrLine = CLIP(LOC:StrLine) & CHOOSE(count# > 1,',','') & CLIP(UPPER(ThisTable{PROP:Name,f#})) count# += 1 END END RETURN CLIP(LOC:StrLine) ---------------------------------------------------------------------------- ------------------------------ Use it like this: Test{PROP:SQL} = 'SELECT ' & BuildSelectList(Test) & ' FROM Test WHERE ...'


Today is November 21, 2024, 3:05 pm
This article has been viewed 35236 times.
Google search has resulted in 29 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: