How do you structure lengthy iLogic projects?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm struggling with how to structure a big iLogic project I'm working on. Generally when programming, I'll start by writing everything in one file and then as that file gets longer and longer, I'll start to break functions or subroutines into separate classes (often different files entirely) to keep things organized. So I'll have a class that handles all my excel related stuff and a class that handles processing of user input values, etc. Then my main script imports those classes to make use of their functions and class-level variables.
I've just gotten to this point in my iLogic project. I'm over 1000 lines of code and it's getting a little cumbersome to navigate, so I'd like to break things apart into more palatable sections, not only for myself while working on it, but for others that might have to edit the script in the future. It's much better to have all your functions and procedures logically organized into a dozen descriptively-named files than one massive script with 100 short-hand-named functions. Unfortunately, I'm finding it pretty difficult to get iLogic to import classes the way I'm accustomed to doing. Usually a single line of code does the trick. ie. import Class1. Later on in the script: length = Class1.lengthInput.
I'm trying to figure out the best way to handle this in iLogic with the whole "ThisRule" issue where as soon as you make a custom class, everything breaks and doesn't work anymore. There's AddReference, but that wants a dll. Not entirely sure how to make that. I thought AddVbRule would do the trick, but then the rule (class) I'm trying to import has to be "Straight VB" which would require me going through and rewriting everything I've already worked on in iLogic to make it VB. I guess in hindsight maybe I should've just done everything in VB to begin with to avoid the limitations of iLogic that I was unaware of at the time. There's the SharedVariables thing, which sounds great for variables, but I can't make use of functions from other rules, which is a lot of why I would want to import the class. I'm trying to not have to copy and paste the same functions into several different files (generally considered bad practice). I feel like this workflow is pretty standard for programming, but iLogic is really fighting me here and seems to want me to just slam everything into one big file with no class-level distinctions.
What is generally the recommended way to structure a rather lengthy iLogic script in the event that you don't want to be contained to one super long file that's a nightmare to sift through? Is there no way around me rewriting everything to be straight VB if I want things to be clean and organized?