SID-00422: Comma in a LISTMAP formula?
| Status: |
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
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.