jaddybalagtas
16th October 2002, 05:11
Sir,
Anyone who can help me I am developing a program where I am to grt a text file then I have a table lets say tcedi906 the fields in that table tells me in which filed I am going to put the data for example in
tcedi906.field=tcedi910.rid1
tcedi906.posi=1
tcedi906.slen=1
meaning that I'm going to take the first entry in the text file and the length is 1 and I'm going to put it in the tcedi910.rid1 field. The question is how am I going to equate the content on tcedi906.field to the table field tcedi906.rid1 is there a function where I can do that? Thanks in advance.

mark_h
16th October 2002, 20:49
I guess you could use dynamic sql to build a query to insert your records. Here is a link: http://www.baanboard.com/programmers_manual_baanerp_help_functions_database_handling_dynamic_sql. Something like read table to get fields, read file, create dynamic sql, insert records.

Also if you are going from a file to a specific table you could probably also use exchange schemes, but I do not know anything about them.

Mark

JaapJD
16th October 2002, 21:05
You can use the put.var function for this:


|* assume buffer contains the record from the textfile

put.var(pid, tcedi906.field, buffer(1;1))

jaddybalagtas
17th October 2002, 11:21
Thanks for the response but my problem is that I want to put the contents on the text file to tcedi910.rid1 put.var will place the con tent of tcedi906.field which is tcedi910.rid1 to the buffer. like this

mess(100)= contents of the text file

select tcedi910.*
from tcedi910
selectdo

tcedi910.????= mess(1;1)

how can I say in my program to get the value of tcedi906.field and that is where im going to put the contents of the text file?

is tcedi910.tcedi906.field=mess(1;1) possible?

or is there an operator where the compiler will substitute the value of tcedi906.field and put that in the tcedi910.???? field?

JaapJD
17th October 2002, 11:33
The compiler doesn't know the contents of the field tcedi906.field, because you read the value at runtime!

When field field tcedi906.field contains the value "tcedi910.rid1", you can give tcedi910.rid1 a value using put.var. See the example in my previous reply. Because tcedi906.field is not between quotes it will use the value instead of the variable itself.