pjohns
26th June 2003, 14:32
Hello,
I want to update a couple of fields in the tiitm001 table.
I have created an Exchange scheme detailing the two fields that I want to update/overwrite. But each time I run the Exchange Import I get 606 errors. When checking the logs I can see that these errors are related to tiitm001 fields that I'm not importing.
At first I thought my exchange scheme needs to include ALL table fields but if you read the help for tuxch0122m000 it says: -
"All TRITON fields which must be filled from ASCII file fields must be specified as individual relations. Fields which are not defined will remain empty when the new record is added, and old values will be retained in case of overwriting. At least all the fields of the primary index of the TRITON table must be defined."
One of my relations is the primary index(item) of the itm001 table.
I have tried creating field relations just for the two fields that I wish to update linking them to the fields in my ASCII file. I've also included all other fields from the itm001 table telling Exchange to use the default value.
Can somebody please point me in the right direction on how to get my update to work?
thanks
PJ
kbartelds
26th June 2003, 14:56
Hi,
If you're seeing reference errors in logfile, and manual change of the item table does not give any problem, you will be inserting records instead of update/overwrite. Might be item alignment? Set insert to false, only use update. If no records are being updated you have an alignment problem, which can be solved be using a field script with shiftl$ or shiftr$.
Regards,
Klaas
Juergen
26th June 2003, 14:58
Hi PJ,
you are right. In your case you have only to include the item field (key field) and the fields that you wants to overwrite/update in your table field definition.
So it seems for me that the settings in "Maintain Table Relations (Import)" and/or "Maintain Field Relations (Import)" are not correct. Maybe you can post the settings you made.
Rgds,
Juergen
NvanBeest
26th June 2003, 15:12
If I read it correctly, all you want to do is update date fields for existing record. I presume your ASCII file has the format:
item(16 chars, aligned correctly)|date1 (format dd/mm/yyyy)|date2 (format dd/mm/yyyy)
Then the easiest would be to point the Exchange scheme to tuxch005 instead of tiitm001. For the first couple of fields you should assign fixed values, and on the field newv create a condition with the following:
string dat(12)
string msg(30)
string path(128)
string line(256)
string item(16)
string date1(10)
string date2(10)
long ftxt
long cntr
long rslt
path = getenv$("HOME") | Or whatever...
cntr = 0
ftxt = seq.open(path & "filename", "r")
if (ftxt < 1) and (ftxt <> -2) then
msg = sprintf$("Error %d opening file", ftxt)
return(msg)
endif
if ftxt = -2 then
return("File not found")
endif
db.retry.point()
while seq.gets(line, 256, ftxt) = 0
rslt = string.scan(line, "%s|%s|%s", item, date1, date2)
if rslt = 3 then
select tiitm001.date1, tiitm001.date2
from tiitm001 for update
where tiitm001._index1 = {:item}
selectdo
tiitm001.date1 = date.to.num(lval(date1(7;4)),
lval(date1(4;2)),
lval(date1(1;2)))
tiitm001.date2 = date.to.num(lval(date2(7;4)),
lval(date2(4;2)),
lval(date2(1;2)))
db.update(ttiitm001, db.retry)
endselect
endif
cntr = cntr + 1
endwhile
commit.transaction()
|* If you want to delete the file after the update, use this:
seq.unlink(path & "filename")
|* else, just close the file
seq.close(ftxt)
dat = dte$()
return(sprintf$("Updated %d items at ", cntr) &
dat(1;2) & "/" & dat(3;2) & "/20" & dat(5;2) & " " &
dat(7;2) & ":" & dat(9;2) & ":" & dat(11;2))
Just fix the date1 and date2 fields, and the filename, and it should work the way you want it!
ssbaan
26th June 2003, 16:06
exchange scheem 606 err problem
We have done exactly what you wnat to do many of times using exchange. You might want to check what you have for the session tuxch0122m000 (Maintain field relations) and on form 2
your entry should be as follows
Triton field overwrite update
item no no
usab (or some other yes yes
field)
Tour table realtions should have overwite only for the table tiitm001.
pjohns
26th June 2003, 18:50
ssbaan - I tried your suggestion but it made no difference.
Juergen - As requested I have attached settings for table and field relations.
Hope this helps
Thanks
PJ
Juergen
27th June 2003, 08:54
Hi PJ,
please set the Field Update Record in "Maintain Table Relations (Import)" to no . For field "item in "Maintain Field Relations (Import)" Update and Overwrite must be set to no as ssbaan suggest.
Juergen
pjohns
27th June 2003, 10:06
Thanks Juergen it's working now.
If I had read ssbaan's post properly I would solved the problem a bit quicker!
Thanks to all for your assistance.
Have good weekends!
Regards
PJ