January 16, 200719 yr How do you check to see if a variable exists before you run a script that is dependent upon that variable having a value?
January 17, 200719 yr Are you asking about a script parameter, script variable or global variable? Well, I think the answer is the same for all three (although a script variable wouldn't have a value when a script starts unless it's been passed from another script. If [ IsEmpty ( $$CustomerID ] ... do whever because no variable Else ... do whatever because there is a value End If LaRetta :wink2: Edited January 17, 200719 yr by Guest Adjusted script
January 17, 200719 yr Use, from the standard menu, Tools - Data Viewer. Create a calc which is '$MyVariable' (if local) or $$MyVariable (if global)... Then 'Monitor' it. Data Viewer will display $MyVariable when you run your custom function or script... You may need to 'refresh' the value during execution of the script, be sure to use the correct type of variable if your script performs sub-scripts. $MyVariable - Autonomous script (i.e. calls no other script..) (Local Variable) $$MyVariable - Nested Script (Global Variable) Update... you can't check it ahead of time as script variables are created in real-time (unless global), use debugger with data viewer to check variable as its created.. Edited January 17, 200719 yr by Guest
January 17, 200719 yr Incidently, what are you using variables for?? By the way... - Great name tag! it's one of my favourite words (Paradigm)...
January 17, 200719 yr Author Are you asking about a script parameter, script variable or global variable? Well, I think the answer is the same for all three (although a script variable wouldn't have a value when a script starts unless it's been passed from another script. If [ IsEmpty ( $$CustomerID ] Yup I think that's it. I had that and it wasn't working for me and it was driving me crazy. I just figured out what my error was as I started to write a response here. I inadvertently had a script step in place that was setting the script variable to "" just a step before I needed it and I was somehow ignoring or missing the change taking place in the data viewer.. Doh! I'll try it again.
January 17, 200719 yr Author Thanks, I was "monitoring" all my script variables but I guess I was looked in somekind of tunnel vision where I wasn't seeing my error explained in the post above.
January 17, 200719 yr Author Incidently, what are you using variables for?? In this case they were being used to drill down in a Construction Estimating Costbook. Divisions>SubDivisions>List of Unit Cost Items. As I was working I realized I could use these variables: $$Find_CategoryID and $$Find_SubCategoryID to "remember" where the user was in the Cost Book and that's where I ran into problems. I think it should work now that I realized what I was overlooking before. By the way... - Great name tag! it's one of my favourite words (Paradigm)... Paradigm is the name of my company(ies). ParadigmProjects.com is the name of my building and remodeling company and Paradigm-360.com is the name of my business consulting operation. I've had the name for 15 years and seen it grow in use and popularity over that time but still I'm always surprised how many people still mangle the pronunciation at times.
January 17, 200719 yr That's some neat stuff you do... On the paradigm-360 site, I noticed your got CCPM.. Critical Chain Project Management if I'm not mistaken, it's a great system, I installed it at my last company using Concerto software... I'm also into TOC, in the UK, and have been playing around with ideas for a DBR scheduling system using Filemaker...
Create an account or sign in to comment