Fill a popup-drop-down with a sorted list of all tables

Ortwin Zillgen (4/23/14 4:09PM)
Florian P?ck (4/24/14 12:55PM)


Ortwin Zillgen (4/23/14 4:09 PM)

color><param>00000,0000,DDEE/param>IIs there a way to define some kind
of sorting in combination of 'Get last table number' or should i first
fill an array with all table-names, sort that array, and then use that
array to fill the popup-dropdown?
/color>
that'll work. As of V14, check ARRAY TO LIST

?<<http://doc.4d.com/4D-Programmiersprache-14.1/Arrays/ARRAY-TO-LIST.301
-1410967.de.html>

check System_Tables <http://dddd.mettre.de/systemTables.shtml#english>

Regards
O r t w i n ?Z i l l g e n
---------------------------------------------
<mailto:info@... =A0=A0<http://dddd.mettre.de?4713>
<feed://dddd.mettre.de/dddd.xml> <https://twitter.com/Ozett>
member of developer-network <http://www.die4dwerkstatt.de>

Florian P?ck (4/24/14 12:55 PM)

Thanks Arnaud,

this was really helpful.

Le 23 avr. 2014 &Ocirc;&oslash;? 14:23, Florian P&Ocirc;&oslash;?ck a &Ocirc;&oslash;?crit :

The 'SET TABLE TITLES' command allows to get table names sorted, for
example:
[code]
C_LONGINT($table_l)
ARRAY LONGINT($table_al;0)
ARRAY TEXT($table_at;0)
//_
For ($table_l;1;Get last table number) ?//;-1)
If (Is table number valid($table_l))
APPEND TO ARRAY($table_al;$table_l)
APPEND TO ARRAY($table_at;Table name($table_l))
End if
End for
SORT ARRAY($table_at;$table_al;>) ?//tri alpha
SET TABLE TITLES($table_at;$table_al)
[/code]
&Ocirc;&oslash;? but it is made for user interface purpose:
1/ use more "user friendly" names for tables/fields
2/ have tables sorted in editors such as QUERY, SORT, etc.
3/ hide some tables
All this to say it won't suit your need.

If you need to get the table from its name:
[code]
//DB_tablePtrByName (tableName_t) -> ptr
//returns a pointer on the table tableName_t if found
C_POINTER($0)
C_TEXT($1)
C_LONGINT($table_l)
C_POINTER($out_p)
C_TEXT($name_t)
Case of
: (Not(Asserted(Count parameters>0;Current method name+" $1
missing")))
Else
$name_t:=$1
For ($table_l;1;Get last table number)
If (Is table number valid($table_l))
If (Table name($table_l)=$name_t)
$out_p:=Table($table_l)
$table_l:=MAXINT ?//end for
End if
End if
End for
End case
$0:=$out_p
[/code]

--
Arnaud de Montard

Reply to this message

Summary created 4/24/14 at 8:11AM by Intellex Corporation

Comments welcome at: feedback@intellexcorp.com