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.

Need help getting this calc to work: replace every other comma with a pilcrow

Featured Replies

Hi there:

I'm close—I just can't figure out what I need to get this calc to work:

Attached is a screenshot of the error message (from the DataViewer) and of course, the file; the calc is "remarked out" so I could preserve it and close the editing window.

I'd sure appreciate the help. Thanks!

Screenshot 2025-10-06 at 3.07.33 PM.png

Temp.fmp12

Try it this way?

While ( [ 
result = YourField ;
n = PatternCount ( result ; ", " ) 
] ; 
n ; 
[ 
pos = Position ( result ; ", " ; 1 ; n ) ;
result = If ( Mod ( n ; 2 ) ; result ; Replace ( result ; pos ; 2 ; ¶ ) ) ;
n = n - 1
] ; 
result
)

This is assuming the input is consistently separated by a comma followed by a space.

 

Here is another way you could look at it, which I think is closer to your attempt:

While ( [ 
values = Substitute ( Yourfield ; ", " ; ¶ ) ;
n = ValueCount ( values ) ; 
result = "" ;
i = 1
] ; 
i < n ; 
[ 
value = GetValue ( values ; i ) & ", " & GetValue ( values ; i + 1 ) ;
result = List ( result ; value ) ;
i = i + 2
] ; 
result
)

This could be streamlined to:

While ( [ 
values = Substitute ( Yourfield ; ", " ; ¶ ) ;
n = ValueCount ( values ) ; 
result = "" 
] ; 
n ; 
[ 
value = GetValue ( values ; n - 1 ) & ", " & GetValue ( values ; n ) ;
result = List ( value ; result ) ;
n = n - 2
] ; 
result
)

 

Edited by comment

Just for fun, you could also do:

While ( [ 
values = Substitute ( Yourfield ; ", " ; ¶ ) ;
n = ValueCount ( values ) ; 
result = "" 
] ; 
n ; 
[ 
result = GetValue ( values ; n ) & Choose ( Mod ( n ; 2 ) ; ¶ ; ", " ) & result ;
n = n - 1
] ; 
result
)

But this one will have a trailing carriage return, unless you change the output line to something like:

Left ( result ; Length ( result ) - 1 )

or:

Substitute ( result & ¶ ; "¶¶" ; "" )

 

Edited by comment

  • Author

Beauty! Thanks!!

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.