NewPeriodicTask2
Lee D Papworth
3-10-19
I have been using NewPeriodicTask2 to import xml files for a number of different customers without any issues.

I have a customer who uses the background task feature to import tab delimited order files. I am wanting to convert them from this and use NewPeriodicTask2 so the imports are not running on the main thread.

However when I attempt to open the file to read and process it I get this error:

2019-03-08 17:53:36 /THREAD(2) Auto Import Orders - Begin
2019-03-08 17:53:36 /THREAD(2) Processing goporder036726050.txt
2019-03-08 17:53:36 /THREAD(2) ERROR: Opening an import file from non-main thread: D:\GalaxyImport\goporder036726050.txt
2019-03-08 17:53:36 /THREAD(2) dump of call stack
2019-03-08 17:53:36 /THREAD(2) 0D27C871 + 1581 halcust\Tools\GOProcess.hal: (no function )
2019-03-08 17:53:36 /THREAD(2) dumping stack due to ERROR: Opening an import file from non-main thread: D:\GalaxyImport\goporder036726050.txt
2019-03-08 17:53:36 /THREAD(2) --------------------------------------------------
2019-03-08 17:53:36 /THREAD(2) 0 0x00754BF3 - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 1 0x00534D88 - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 2 0x006061FD - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 3 0x007053BA - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 4 0x006F02E2 - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 5 0x006F16E9 - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 6 0x006EDF55 - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 7 0x0068C3C8 - 0x0000000000000000
2019-03-08 17:53:36 /THREAD(2) 8 0x77648484 BaseThreadInitThunk - 0x0000000077648460
2019-03-08 17:53:36 /THREAD(2) 9 0x77A541C8 RtlAreBitsSet - 0x0000000077A54140
2019-03-08 17:53:36 /THREAD(2) 10 0x77A54198 RtlAreBitsSet - 0x0000000077A54140
2019-03-08 17:53:36 /THREAD(2) --------------------------------------------------
2019-03-08 17:53:36 /THREAD(2) 8549001531
2019-03-08 17:53:36 /THREAD(2) ERROR: Closing an import file from non-main thread

With xml files I do not open them but use the ParseXMLFile command.

I have rechecked my code and everything is all correct. It just seems I cannot open them as I normally would when I use the NewPeriodicTask2 command.

Customer is currently running 8.2 2016-12-18 (build 82211904) I am in the middle of migrating them to 8.5 and would like to get this resolved as part of the migration.

Any ideas?

Thanks


Lee Papworth
Paul Timms
3-11-19
Hi Lee

I've not used ParseXmlFile. For these types of import I normally use AddFileToArea and then ParseXmlArea. Whether that would make any difference for you, I don't know.


Paul
Lee D Papworth
3-11-19
Created byPaul Timms12:59 11 Mar 2019
Hi Lee I've not used ParseXmlFile. For these types of import I normally use AddFileToArea and then ParseXmlArea. Whether that would make any difference for you, I don't know. Paul
Thanks Paul,

I have gone for the AddFileToArea and it has got me over the problem trying to OpenFile from a thread.

As this is a tabbed delimited file I am having to use the GetTabTextFromArea(row,column,area) command.


I am having to do this for each tabbed field and each row but it is working.


If you know of a way of returning the number of rows and the number of columns per row from an area I would appreciate some guidance. Tried a few different commands with no joy so at the moment I am hard coding these values.

Thanks again

Lee

Paul Timms
3-13-19
lcnt = CountLinesInArea(afile);
for (lnr=0;lnr t = 0;

field1 = GetTabTextFromArea(lnr,t,afile); t = t + 1;
field2 = GetTabTextFromArea(lnr,t,afile); t = t + 1;
etc.
end;
Paul Timms
3-13-19
Weird, it cut off that second line, let's try again...

for (lnr=0;lnr t = 0;
Paul Timms
3-13-19
Nope, must be a bug in this forum that doesn't allow it!
Swati D.
12-18-19
Hi Lee

Do you still require assistance with this?
Swati
Lee D Papworth
12-19-19
No Swati, I sorted myself.

I still 2 open questions that need resolving though
Swati D.
12-24-19
Hi Lee

Apologies for the delay. I am pushing for a reply on those too

Merry Christmas to you!

Swati
Lee D Papworth
12-24-19
Created bySwati D.17:19 24 Dec 2019
Hi Lee Apologies for the delay. I am pushing for a reply on those too Merry Christmas to you! Swati
Thanks Swati

A very Merry Christmas to you also
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Back to the list
Latest Posts
Reino Botha
Please check your version of android if it is the same as the server you are connecting too. ...
08:24 21 Nov 2024
Bror-Erik Kotiranta
In NC you hace operations>>ai chats. They are used for these Br, Bror-Erik...
05:12 21 Nov 2024