geeool Posted January 15, 2020 Share Posted January 15, 2020 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) Quote Link to comment Share on other sites More sharing options...
ThomasLewis Posted January 15, 2020 Share Posted January 15, 2020 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. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 16, 2020 Share Posted January 16, 2020 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. Quote Link to comment Share on other sites More sharing options...
geeool Posted January 16, 2020 Author Share Posted January 16, 2020 Thanks - that worked! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.