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.

What the hey?! Should work?

Featured Replies

Hi all,

Once again, when I think I'm making headway with my self- teaching methods, I take one right across the forehead.

I have a number in a text field (so that it will display a hyphen) that is 8 digits long.

12345678

This "job number" can have "sub" jobs, and we ad "-1", "-2", etc.

12345678-1

12345678-2

My script starts like this:

[color:green]Case(

(Length (GetAsNumber (Job Number)) = 8); (Job Number) & "-1";

That determines that the number has 8 numerals and it ads a "-1" to it. It works fine.

Then, if it doesn't see 8 numerals, it asks what the suffix is here (in this case, it sees 12345678-7, and makes the next record 12345678-8. It works fine.

[color:green]Right (Job Number;1)=7; (Left (Job Number;8)) & "-8";

Then, when it gets to the teens, it only adds the last number! I can't figure it out. It does NOT work fine. So the following would be 12345678-13, but the returned number is 12345678-4.

[color:green]Right (Job Number;2)=13; (Left (Job Number;8)) & "-14";

Thanks!

MW

It's a little unclear... Is this a Set Field script step? Is everything in green part of the same Case statement?

I'm assuming yes to both of those questions and the answer is simple...a Case statment evaluates test sequentially. So if the job number is -13, the statment evaluates the Right(Job Number;1)=3 first and it tests true and returns -4.

You can rejigger your Case function by switching the second and third tests as stated in your post and it should work, though

I'm guessing the whole statement is very kludgy.

Try this:

Let([

Nums = Length(Trim(Job Number));

NextNum = 1+ Case(Nums = 8;0; Right(Job Number; Nums-9) )

];

Left(Job Number;8) & "-" & NextNum

)

Edited by Guest
Slight change to calc

  • Author

Smack! (That's my palm hitting my forehead)

Yes, it sees the second digit of the teens again.

I am going to try your calc. It is certainly a lot cleaner than mine. One more lesson learned.

Thanks

MW

  • 2 weeks later...
  • Author

Thanks crazy eye,

Works like a charm.

MW

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.