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.

How do I apply a substitution to this calculation?

Featured Replies

Hi All, I have this fairly simple field, it's a calculation that returns a list, and it works well:

If ( IsEmpty ( IP Addresses::IPv4 Address ); "No Static IP"; List ( IP Addresses::IPv4 Address ) )

However, in the resulting list that displays, I'd like to substitute the carriage returns with commas, and I've come up with this bit of code to make the substitution:

Substitute ( IP Address Display; "¶" ; ", "  )

Is this correct? If so, where do I place the substitute statement? Will it go into the same calculation I use to define the field, or do I have to put this into a brand new field of its own?

 

Thanks in advance,

C

Nice job of breaking out the calculation need.  :-)

 

Wrap the Substitute() around the List() function to turn its pilcrow into comma-space.

If ( 
IsEmpty ( IP Addresses::IPv4 Address ) ; "No Static IP"; 
Substitute ( List ( IP Addresses::IPv4 Address ) ; ¶ ; ", " ) 
)

As for where/how to use it, it sounds like simply for display.  Is it display on a report, portal, or how is it used?  Normally you do not want to create any calculation unless you absolutely have to.

 

Edited:  corrected calculation

Edited by LaRetta

You have a typo: the pilcrow character can be either quoted or (if on its own) not quoted - but not half-quoted. :hmm:

Picky, Picky, Picky. LOL :giggle2:

  it's me eyes, ya know.   :yep:

I am such a fuss bucket.  I had to correct it.  But I'm not nearly so much a fuss bucket as you, Michael ... you never make the mistakes to begin with.  ;-)

  • Author

Ah, beautiful! I didn't realize you could embed a function into another function where it asks for a field. Coolbeans :) Thanks for the help.

I remember when lightbulbs began to fire on this myself!  And you'll question ... which function should go on the outside and which on the inside.  Sometimes it doesn't matter but most times it does.  Just keep in mind that FM evaluates the innermost function first so in this case, the List() and then the Substitute() is applied against that.

 

Calculations rock.

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.