Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6521 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted (edited)

I need some help.

This is complex, but here goes:

I have three files on FM 8 server. I have a products table in an inventory fm7 file that is using an edi fm7 file to make a http request and import some xml data into the edi file. That data in the edi file is then imported back into a catalog table (CT) in the inventory file AND into another catalog file (CF). I can import the xml data into to the edi fine. Due to some oddities in the xml feed I have to import some fields into the edi fm7 file in some return delimited fields which must be parsed after imported. I use some scripts in the edi file to parse these return delimited fields out into separate fields in separate tables in the edi file which I then import into the catalog file (CF). The problem I am having is this: I have scripts that parse the return delimited fields in the edi file and these scripts rely on some "set fields" and some variables and one custom function. I call these scripts in the edi file from my inventory file. These scripts in the edi file work fine when I run them step by step in with the script debugger on, even when called from the inventory file. They also run fine if I put a "Show Custom Dialog" that returns Get(LastError) right before my parsing script sets the variables and starts looping through the return delimited fields and parsing data (using variables and set fields) into the other tables in the edi file.

What is puzzling me is that everything works with the script debugger on, but the parsing routines fail to parse anything with the debugger off. The "Set Field" that uses the custom function returns a blank value if I run the script without the debugger on. I have tried multiple things to identify the problem. I have replaced my custom function (which just grabs one line from a return delimited field) with a function from Troi Text and I get the same problem. I have tried replacing the variables I use to loop through the return delimited fields with global fields. Neither of these have worked.

What is really odd (and I discovered this solely through my own debugging) is that if I simply put a "Show Custom Dialog" that returns the result of the Get(LastError) function when I start setting the variables right before my loop that parses the return delimited fields in my edi file, it works. It just just won't work with the debugger off or without the the "Show Custom Dialog."

I think I have all the relationships set up correctly .... if not, then why would it work with the script debugger on?

What am I doing wrong?

I hope this is enough to go on. Any help would be appreciated.

deffenda

Edited by Guest
Posted

This is a bit odd (but odd is up my alley) ...

I've had the same thing happen. The difference *may* be because you are running the script through ScriptMaker instead of via a button which *may* hold a critical script parameter. Or running it from other layout (table) than the button is on. I now remind myself to move to the same layout and 'be a User' before I turn on Debugger. A script fired through Debugger or not, can easily suffer these types of issues. Are you passing parameters or variables when the 'true' script runs that you aren't running while Debugging or is this a sub-script? Look for things such as these ...

LaRetta

  • Newbies
Posted (edited)

I did have a script parameter that I was passing from the Inventory script to the edi script that performed the http lookup/xml import, but I have taken it out and it still doesn't work. That parameter was never passed to the script in the edi file that did the parsing.

I can use a "Show Custom Dialog" to give me the values of my variables as I set them in the parsing script in the edi file. If I manually set them such as set var = 1, the show custom dialog returns the correct value. If I set the value of my variable through a very simple calc. such as counting the returns in my fields that need to be parsed (using ValueCount()) it returns 0 - or no value (which is wrong). If I just run the script using the script debugger or show a dialog getting the last error right before I show the value of my variable with a custom dialog, the variable is correct.

I can repeat the issue with the data viewer instead of using the show custom dialog to get my variable values.

I can also repeat this with global fields instead of variables.

Why would the debugger or inserting a show custom dialog allow this parsing script to work whereas otherwise it fails?

This is just odd.

deffenda

Edited by Guest
Posted

You're using multiple files? Are you aware that variables won't cross files? I believe you'll need to set a global but I don't perform a lot of multiple-file scripting in 7/8 because all scripting is handled in one file.

I see you've tried setting a global. As Fenton says, something is amiss. All we can do is keep guessing unless you provide the script or file. Again, what table occurrence are you on (layout) when you are Debugging and is the same as when the button is pressed?

  • Newbies
Posted (edited)

My inventory file calls a script in the edi file that has a text parsing routine that uses variables to parse the text. The text parsing script in the edi file works fine with the debugger on when called from the inventory file. It fails with it off.

I have tried both $ local and $$ global variables. I have replaced all variables in the text parsing script with global fields. The result is the same. The script works with the debugger and fails without it.

Replacing the variables with globals would seem to address the concern about variables between the files. Moreover, the the text parsing script with variables works fine using the debugger.

I am not trying to pass variables between files, though I do wonder about calling a script in another file that uses variables. The script in the edi file just uses the variables while that particular script is running. I'm not referencing these variables outside of the parsing script in the edi file. I'm certainly not referencing them in the Inventory file (except through the show custom dialog - I'm not sure if this changed things)

I can use the debugger to step through the script and let PART of the text parsing script complete. It works fine when I do this. If I then allow the debugger to run to the end of the script instead of stepping into each step, the text parsing script in the edi file fails to work whereas it was working fine when I was stepping through it.

I can run the parsing script from within the edi file and it parses fine without having the debugger on. I can even call the text parsing script from another script in the edi file and it works fine. It just fails when I call it from the Inventory file without the debugger on or without a Show Custom Dialog.

Maybe I am missing a relationship?

This is very strange, isn't it?

Edited by Guest
Posted

This is very strange, isn't it?

No. It is just unidentified. I believe you are too close to it to see it; that is pretty common. Other sets of eyes will help so provide the script or file. I still question your perspective upon script fire, ie, running it from Inventory might be picking up the wrong ID etc. :wink2:

Posted

This:

I have tried both $ local and $$ global variables

....and the use of the debugger suggests, an update of your profile, while we're at it why don't you use the dataviewer while tracing thru your scripting or are you only on fm8 adv?

Next issue is that you nowhere in you description, justified the parsing of data being in xml-form or not, when relational approaches suggests such task just deal with the id's referencing the data, only the arrival of a ordering document, needs some handling.

--sd

  • Newbies
Posted (edited)

Thanks to all who posted.

I was not setting a match field correctly and somehow the debugger and the show custom dialog made it work. Specifically, some of my "set field" steps should not have worked because I had not set the match field field correctly but they worked under the debugger and when the the two "unrelated" tables/files were somehow "related" by a show custom dialog that passed a variable from one to the other.

The comment that an ID field was not set properly made me go back and look this again.

I have moved the edi inside my inventory file.

The reason I am parsing fields from an xml import is that I can parse data for up to ten products into five child (plus one parent) tables with only one http/xml request. I can make separate http requests and get the same info, but I would need to make 6 requests X 10 products to get the same result. 1 request versus 60 is a lot faster, especially when the xml source puts a limit on the number of requests that can be made.

Thanks,

deffenda

Edited by Guest

This topic is 6521 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.