Jump to content

How to make array data global?


Recommended Posts

I have an online product that accesses an external data file to pull-in data for generating barcodes. Is it possible to use an OnRecordStart rule to pull in the data from the external data file, put the data into an array and then make the array available globally for use in other rules?

 

Currently I'm putting the data from the external data file into variables and then creating an array. What I don't understand is how to make it available globally? I've tried using "return arrayname;" in the OnRecordStart rule, but that hasn't worked when trying to use the array in other rules. Is what I want to do possible? Any help is greatly appreciated.

 

(FusionPro Creator 10.0.6, MarcomCentral storefront)

Link to comment
Share on other sites

You can assign global variables in OnRecordStart by omitting the "var " before the assignment.

 

Then in your other rules put this bit in the top line:

if (FusionPro.inValidation)

Rule("OnRecordStart");

 

That way when the rule validates, it will load them in and not give you an error that they are not defined.

Link to comment
Share on other sites

Well, I'm trying to guess at exactly what you're trying to accomplish here, but, while Thomas's advice is not wrong, it could be that you only want to create this array once per job, in which case you could do it in OnJobStart, or even in the JavaScript Globals.

 

As usual, asking a more specific question (ideally posting the collected template, or at least the data file) is likely to yield more specific answers/suggestions.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...