Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3796 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted (edited)

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
Posted

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.  ;-)

Posted

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.

Posted

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.

This topic is 3796 days old. Please don't post here. Open a new topic instead.

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.