Page 1 of 1
fill field Contents
Posted: Thu Jul 17, 2014 9:54 am
by francof
ciao all,
how can I use the Contents pane, in the property inspector of a Basic Table Field, to insert the data columns of a database respecting the order of it?
for example:
from the Db table_Ident
name. . . . .last_name
Bill. . . . . . . .The Kid
Robert. . . . . .Zimmerman
into the field
1° col. . . . .2° col
bill. . . . . . .The Kid
Robert. . . . .Zimmerman
using the icon folder button of the Contents pane, I tried to open the DB directly, also convert first the Db into a .xls or .txt file. but, obviously, it does not work.
thanks for help
franco
Re: fill field Contents
Posted: Thu Jul 17, 2014 11:29 am
by Klaus
Hi Franco,
the "table field" is just a text field and accepts TAB delimited TEXT (and text files) but you cannot connect to a database here.
So put your data into a TEXT file (TAB delimted!) and you can import it via the "folder" button in the inspector.
Of course you can put the data that you have fetched from a database directly into a "table" field via script!
Best
Klaus
Re: fill field Contents
Posted: Fri Jul 18, 2014 9:48 am
by francof
ciao Klaus, nice to meet you again.
Klaus wrote:...
Of course you can put the data that you have fetched from a database directly into a "table" field via script!
Best
Klaus
I should like but, I again fight against item delimiter
this trash:
Code: Select all
put "SELECT distillato,descrizione FROM tbldistillati order by distillato" into tQuery
--This will query the Database Table using the statement in tQuery
put numtochar(1) into tItemDel
put numtochar(2) into tLineDel
put revDataFromQuery(tItemDel, tLineDel, tDatabaseID, tQuery) into tDatapiatti
returm me all data into the first column of the field
best
franco
Re: fill field Contents
Posted: Fri Jul 18, 2014 11:19 am
by Klaus
Franco,
do you remember what the DEFAULT delimiters in database queries are?
We used some time to finally change it to numtochar(1 and 2) to fit your needs!
We did this because your database fields contained MULTILINE text.
If you now use a field (instead of a datagrid) you will have the SAME problems with MULTILINE text!
If not, well what is the logical conclusion to this fact? Hint, see my first sentence!
Best
Klaus
Re: fill field Contents
Posted: Fri Jul 18, 2014 11:51 am
by francof
Klaus wrote:Franco,
do you remember what the DEFAULT delimiters in database queries are?
...
TAB and CR
Klaus wrote:...
If you now use a field (instead of a datagrid) you will have the SAME problems with MULTILINE text!
If not, well what is the logical conclusion to this fact? Hint, see my first sentence!
...
do you mean to use default delimiter? no dai!
it works only with records without multi line text. I don't like make only copy-and-paste, without know that I'm doing. at present I'm so far....
ciao
franco
Re: fill field Contents
Posted: Fri Jul 18, 2014 12:05 pm
by Klaus
But you now need to decide what to do!
1. So your data HAS multiline text, right?
2. TAB and CR does not work if this is the case.
3. numtochar(1/2) does also not work for a TABLE field. which is ONE field and not a lot of grouped objects like a datagrid
Can't you also use a datagrid here?
If you really need to use a TABLE field then this is possbile, but needs a lot of preparation to make the data fit!
Re: fill field Contents
Posted: Fri Jul 18, 2014 3:35 pm
by francof
Klaus wrote:But you now need to decide what to do!
1. So your data HAS multiline text, right?
2. TAB and CR does not work if this is the case.
3. numtochar(1/2) does also not work for a TABLE field. which is ONE field and not a lot of grouped objects like a datagrid
...
1 yes
2 yes
3 yes: good, this is another new information for me.
Klaus wrote:...
Can't you also use a datagrid here?
If you really need to use a TABLE field then this is possbile, but needs a lot of preparation to make the data fit!
I've never used DataGrid object, not even in the other occurrence, where you explain to me the use of numtochar(1/2), I put data into a list field.
I can show what I've, the code below comes from an old version of the project I want to implement (and is not mine...)
Code: Select all
on mouseUp
local tDatabaseID
put revOpenDatabase("ODBC", "esa", "esa", "abcd", "1234" ) into tDatabaseID
put "SELECT distillato,descrizione FROM tbldistillati order by distillato" into tQuery
--This will query the Database Table using the statement in tQuery
put revDataFromQuery(tab, cr, tDatabaseID, tQuery) into tDatapiatti
--This will display all the data from the Database
put tDatapiatti into field "elenco_argomenti_risposta"
--This closes the Database connection
revCloseDatabase tDatabaseID
end mouseUp
this code put the data into a field "elenco_argomenti_risposta" see below

- Immagine.jpg (17.45 KiB) Viewed 5756 times
what I don't understand is how tab and cr delimiter they can work, the Db is another version but, the data are the same. may have been inserted in a different way: without multiline text, difficult to think.
this is what I want to do.
could fit even a Data Grid, if it is easier to use
ciao
franco
Re: fill field Contents
Posted: Fri Jul 18, 2014 7:53 pm
by phaworth
You might try using revQueryDatabase instead of revDataFromQuery. It returns a cursor id instead of the actual data. You can then navigate thru the records using revMoveToxxxRecord (xxx=First/Next/Prev/Last) and revDatabaseColumnNamed to get the data from a column into a variable.
You still have to deal with return and tab characters in the data of course. I usually do that by replacing them with a string of some sort. Or you can replace return with numToChar(11) to handle return characters.
Pete
Re: fill field Contents
Posted: Sat Jul 19, 2014 2:34 pm
by francof
tanks Pete for your suggestion.
I've solved, finally, changing the delimiters. here put the recordset from the query into a Table Field:
Code: Select all
put revDataFromQuery("§","|", tDatabaseID, tQuery) into tDistillati
replace cr with " " in tDistillati
replace tab with " " in tDistillati
replace "§" with tab in tDistillati
replace "|" with cr in tDistillati
---------------------This will display all the data from the Database
put tDistillati into field "elenco_argomenti_risposta"
and below show data, divided by elements, into different text fields and labels
Code: Select all
command visualizza_risposta
put fld "elenco_argomenti_risposta" into tTempList
filter tTempList with the text of the field"txtcerca_argomento" & "*"
set itemdel to tab
--put tTempList into fld "txtdescrizione"
put item 2 of tTempList into fld "txtdescrizione"
put item 3 of tTempList into fld "lblOrigine"
end visualizza_risposta
ciao all
franco