AnsweredAssumed Answered

Variables, Logical Operators, Global / Field Types - Not as expected

Question asked by Eric Whittaker Jr on Mar 24, 2018
Latest reply on Mar 24, 2018 by Eric Whittaker Jr

I have an interesting situation that I believe I understand the root of the problem. But I want to understand more. I have a script that deals with navigation. It creates variables based on script parameters. These variables get stored in global fields to use later. To lay the foundation I will explain the script parameters I use.

 

Variables

I use numbers as parameters which relate to layouts.

Parameter "1" = Dashboard

Parameter "2" = Trucking

Parameter "3" = BuildLog

Parameter "4" = Venue

Parameter "5" = Contacts

Parameter "6" = Users

Parameter "7" = Admin

Parameter "8" = Advance

 

These get passed to the script as a script parameter

 

In the script, I set a variable to those script parameters

 

I then use those variables in If statements to check to see which part of the script (named "NavControl") I should run

 

This would have worked pretty straightforward but then my navigation got a little more complicated.

 

My "Dashboard" layout now had another layout "Dashboard - List" for searching records that are either "Live", "NoGo", "10DaysOut" so I needed to add some more parameters.

 

Parameter "1" = Dashboard

Parameter "1a" = Dashboard - List - Live"

Parameter "1b" = Dashboard - List - NoGo"

Parameter "1c" = Dashboard - List - 10DaysOut"

Parameter "2" = Trucking

Parameter "3" = BuildLog

Parameter "4" = Venue

Parameter "5" = Contacts

Parameter "6" = Users

Parameter "7" = Admin

Parameter "8" = Advance

 

Global / Field Types

Having many dashboards now required the use of a Global field "LastNavControl" where I would store the last parameter so when I navigate away from the Dashboard layouts I knew which one to return back to when a user navigates there way back.

 

The script seemed to work fine but for some reason when I would have a variable = "1b" it would store the variable in the Global field as 1. I finally realized that the Global field was set to be of type Number. So my questions are.

 

How does a field of type number when being set with a value of "1b" know to only set the field to 1?

What are the guidelines for values that are not the same type of the field they are being set to?

 

Hope that this makes sense and would really appreciate some explanation on this topic.

 

Thanks,

Outcomes