Page 1 of 1

Combing first name and surname into a datagrid table

Posted: Tue Jun 13, 2017 12:45 pm
by montymay
I have a sqlite database in which surnames and first names are in different columns. I want to populate a datagrid table such that the first name and surname are put into one datagrid column in that order, separated by a space. Is that possible? Can anyone suggest the script or a tip on how to do it?

Code: Select all

     repeat for each line i in tData
put item 1 of i into tArray[tCounter]["rsnum"]
put  item 2 of i into tArray[tCounter]["surname"] -- I want to concatenate this line
put item 3 of i into tArray[tCounter]["firstName"] -- and this line will display "firstName SurName" in the DG
put item 4 of i into tArray[tCounter]["debtAmt"]
put item 5 of i into tArray[tCounter]["dateOpened"]
put item 6 of i into tArray[tCounter]["debtType"]
put item 7 of i into tArray[tCounter]["order"]
put item 8 of i into tArray[tCounter]["NextHrg"]
add 1 to tCounter
     end repeat
     set the dgData of grp "dgDefendants" to tArray
Thank you for the answer or any suggestions.

Monty May

Re: Combing first name and surname into a datagrid table

Posted: Tue Jun 13, 2017 1:35 pm
by Klaus
Hi Monty,

does you datagrid already have a column for this?
Maybe a column named "fist_last_name"?

Whatever this might give you an idea:

Code: Select all

...
   repeat for each line i in tData
      put item 1 of i into tArray[tCounter]["rsnum"]
      ## put  item 2 of i into tArray[tCounter]["surname"] -- I want to concatenate this line
      ## put item 3 of i into tArray[tCounter]["firstName"] -- and this line will display "firstName SurName" in the DG
      put item 2 of i && item 3 of i into into tArray[tCounter]["fist_last_name"] 
      put item 4 of i into tArray[tCounter]["debtAmt"]
      put item 5 of i into tArray[tCounter]["dateOpened"]
      put item 6 of i into tArray[tCounter]["debtType"]
      put item 7 of i into tArray[tCounter]["order"]
      put item 8 of i into tArray[tCounter]["NextHrg"]
      add 1 to tCounter
   end repeat
   set the dgData of grp "dgDefendants" to tArray
...
Best

Klaus

Re: Combing first name and surname into a datagrid table

Posted: Wed Jun 14, 2017 11:15 am
by montymay
Thanks, Klaus, your amended line works perfectly.

Monty