Jump to content
Server Maintenance This Week. ×

This one's got me... How to validate a field based on several settings


Go to solution Solved by comment,

Recommended Posts

Hello:

 

here's what I've got:

1) a table (AppPrefs) with 1 single record with the Fields "IsUsingExt", "G_IsUsingExt", "ExtStart", "G_ExtStart", "UserDigits", and "G_UserDigits" the "G_" variants are global fields that get their values from from their non-global counterparts. 

2) A Layout based on (AppPrefs) with 3 fields that use the non-global variants of the fields; the fields are "Are You Using Extensions" (yes or no from a value list), "What digit should all extensions start with" (PopupMenu from value list with custom values of the digits 0-9 called "digits"), and "How many digits should an an extension contain AFTER the start digit?" (again same settings as the start digit setting above).

3) three variables defined in my startup script $$IsUsingExt, $$ExtStart, and $$UserNumber that represent the three fields identified above that are pulling the global fields as expected

My objective is for that these preferences should be set one time and take effect everywhere and here's how:

1) each person record contains an extension field.  Based on the preference for "Are you using extensions" the extension field should either be required or not

2) based on the extension start digit and number of digits after start digit values the extension field should populate (if start digit is 2 and user number is 3 then simply entering 123 would result in 2123) thus you put in X digits (all the way up to 9 and the system adds the leading digit Y on commit.  If the field doesn't meet these criteria (using the same example as above but this time entering 12, then get an error)

3) if the "Are you using extensions" is set to "No" then none of it really matters and it should be allowed to be blank.

 

When I look at the data viewer, all the variables populate like they should, when I enter a new extension based on the settings I specified in preferences (start digit is 2 and user number is 3, using extensions is "Yes") then click out the field tries to populate with 8 plus whatever I entered rather than start digit plus whatever I entered it's set to auto-enter calculation with the formula being PersonExt= AppPrefs::G_ExtStart & PersonExt

 

So the question is how do I make this work the way I want (if extensions are set to "Yes" then they should be whatever is entered proceeding by the start digit.  Whatever is entered should have a length no less than or no greater than the value for user digits also extensions should be unique.   if extensions are set to "No" then it's OK to leave it blank but don't allow any value in the field for the anyone's extension.

 

Thanks for any help on this one!

 

Link to comment
Share on other sites

  • Solution

Side note: if you have global fields in the AppPrefs table, then there is no need for the global variables (and vice versa).

Now, for the auto-enter, you could try something like:

If (
AppPrefs::G_IsUsingExt = "Yes" ;
AppPrefs::G_ExtStart & Self ; 
"" )

and for the validation:

Length ( Self ) = G_UserDigits + 1 
or
AppPrefs::G_IsUsingExt = "No"

However, this has a some potential flaws, most notably this: when editing the field, the user must remove the auto-entered starting digit, otherwise it will be inserted again before the existing one.

Overall, it seems that there should be a simpler approach to accomplish whatever this is supposed to accomplish. For example, the starting digit could be taken directly from the global field (or variable), with no need to copy it into the user-entered field.

 

  • Plus1 1
Link to comment
Share on other sites

15 minutes ago, comment said:

Side note: if you have global fields in the AppPrefs table, then there is no need for the global variables (and vice versa).

Now, for the auto-enter, you could try something like:

If (
AppPrefs::G_IsUsingExt = "Yes" ;
AppPrefs::G_ExtStart & Self ; 
"" )

and for the validation:

Length ( Self ) = G_UserDigits + 1 
or
AppPrefs::G_IsUsingExt = "No"

However, this has a some potential flaws, most notably this: when editing the field, the user must remove the auto-entered starting digit, otherwise it will be inserted again before the existing one.

Overall, it seems that there should be a simpler approach to accomplish whatever this is supposed to accomplish. For example, the starting digit could be taken directly from the global field (or variable), with no need to copy it into the user-entered field.

 

Yes, I’ve seen the one possible flaw you mention; that’s just a user training issue. 
 

the entire thing is trying to be a directory for say a small office (since not everyone uses a PBX phone system with the same settings (extension length, extension start digit) or even uses a PBX (say everyone communicates using IM, or work issued cell phones the entire extension concept would be useless in that scenario thus the ability to turn extensions off in application preferences)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.