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.

translating number into number of times displayed

Featured Replies

I have a field which contains a number."Number"

I have a global in which I would like to translate that number into the number of times I display the letter x.

So if the number field contains "7"

I would like the global field to calculate this "xxxxxxx"

So if the number field contains "13"

I would like the global field to calculate this "xxxxxxxxxxxxx"

Thanks

Dave

Hi, Dave. Try creating a second global field called Counter and then using this script:

If [ "Number <= 0" ]

Well, it would be a calculation field, since a global calculation won't auto-update the same way. Assuming you can have up to 100 in the number field, your calculation field would be Left( number, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ). Change the comma to a semi-colon for version 7.

If using Developer, you could also create a Custom Function that would do it without hard-coding 100 or more xes.

Jerry's script is more dynamic than my calculation. However, it will require users to click a button to update the field after 'number' is changed.

Hello Stann,

Whether by script or by calculation, I suggest that you use the formula:

Substitute(Right(10^Number, Number), "0", "x")

- which will produce the desired number of 'x' characters for 'Number' values in the range from 0 to 214. If you need a range that goes beyond 214, a slightly more complex formula will be needed - but nothing that requires you to type a hundred Xs... wink.gif

Nice. I've never seen that one before. I thought it could be done, but never had need for it. Thanks, Ray.

Of course that is for FileMaker v6.

For v7, I'd suggest using the following Custom Function:

Extrapolate ( String; Number )

with the function definition being:

Case(

Number > 0;

String & Extrapolate ( String; Number - 1 )

)

...which will be good for value ranges of 'Number' from 0 to 9,999. cool.gif

I knew when i was writing my solution that there would be a better one... i didn't think that there would be TWO.

tongue.gif

J

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.