> Le 8 nov. 2019 à 02:30, Chip Scheide via 4D_Tech <[email protected]> a 
> écrit :
> 
> 
> Thanks!

Hi Chip, 
I'd add 2 things… 
1/ the INTO LISTBOX target variable must not be a local one
2/ after the SQL populates the listbox, resulting headers/columns names are 
"automatic" and uneasy to predict; I also remember in previous 4d versions they 
could use existing names in the form without throwing an error; anyway I prefer 
to rename them after the query:

 //LB_renameCH (LBname_t)
 //rename columns + headers of a listbox using listbox name
C_TEXT($1)
$LBname_t:=$1
$nbCol_l:= LISTBOX Get number of columns(*;$LBname_t)
ARRAY TEXT($obj_at;0)
LISTBOX GET OBJECTS(*;$LBname_t;$obj_at) 
For ($i_l;1;$nbCol_l)
        $arr_p:=OBJET Get pointer(Object named;$obj_at{$i_l*3-2})
        $head_p:= OBJET Get pointer(Object named;$obj_at{$i_l*3-1})
        $title_t:=OBJET Get title(*;$obj_at{$i_l*3-1})
        $Cname_t:=$LBname_t+"_C"+String($i_l)
        $Hname_t:=$LBname_t+"_H"+ String($i_l)
        LISTBOX INSERT 
COLUMN(*;$LBname_t;$nbCol_l+$i_l;$Cname_t;$arr_p->;$Hname_t;$head_p->)
        OBJET SET TITLE(*;$Hname_t;$title_t)
        LISTBOX DELETE COLUMN(*;$LBname_t;1)
End for

-- 
Arnaud de Montard 





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

Reply via email to