Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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!

 

Solved by comment

Go to solution
  • 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.

 

  • Author
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)

  • Author

Update:

 

that did it 😉. Thank you again for another fabulous solution!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.