Tags:
create new tag
view all tags

SID-00422: Comma in a LISTMAP formula?

Status: Answered Answered TWiki version: 4.2.3 Perl version:
Category: CategoryPlugins Server OS: Last update: 16 years ago

I'm trying to use a comma in a LISTMAP formula, but it causes the CALC to break: the comma is interpreted as a list separator and so the second half formula becomes a list item.

For example:

  • This: %CALC{$LISTMAP([$index:$item], 3, 5, 7, 11)}%
  • Returns: [1:3], [2:5], [3:7], [4:11]

But if I instead I want that to look like [1,3], [2,5], [3,7], [4,11]:

  • This: %CALC{$LISTMAP([$index,$item], 3, 5, 7, 11)}%
  • Returns: [1$item], [23, [35, [47, [511

I've tried various things to keep that comma from being interpreted, "$comma", "\,", "$CHAR(44)", but none of those worked.

Any ideas?

-- SeanCMorgan - 2009-07-16

Discussion and Answer

>But if I instead I want that to look like =[1,3], [2,5], [3,7], [4,11]: =

Well, more than "look like", because I can do that with this: [1,3], [2,5], [3,7], [4,11]

It actually has to be a comma, because the generated text is then processed by another program (to make a graph).
But I'll use that as an intermediate step and then post-process it with SUBSITUTE and TRANSLATE.

-- SeanCMorgan - 2009-07-17

Correct, you can first specify a $LISTMAP() with a temporary character other than comma, such as [$index:$item]. Wrap the result into a $TRANSLATE() to change the temporary character into a comma.

-- PeterThoeny - 2009-07-17

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Comma in a LISTMAP formula?
SupportCategory CategoryPlugins
TWiki version 4.2.3
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2009-07-17 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.