Bedrock delimiter

Post Reply
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Bedrock delimiter

Post by schlemiel29 »

I try to use bedrock functions, whenever possible. When exporting values from a cube, there is a pThousandSeparator parameter. I want to set it to nothing, because in output I don't want any formatting. Just the numbers as they are, e.g. 12345.78 or 12345,78 if I need a comma.
But if the parameter pThousandSeparator is empty, the function will insert "," by itself! I don't want to change the Bedrock code to keep it compatible, or what can I do else?
Wim Gielis
MVP
Posts: 3223
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Bedrock delimiter

Post by Wim Gielis »

When you think that you stumbled upon an issue, you can create a new issue in the Bedrock repository in GitHub.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Re: Bedrock delimiter

Post by schlemiel29 »

OK, that may be a long term solution. My question was, if I missed a detail or if I should use the function differently, because I never think, that I was the first one, who discovered an issue. :D If it is not a bug, but it is a feature, I can live with that.
Thanks Wim!
Wim Gielis
MVP
Posts: 3223
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Bedrock delimiter

Post by Wim Gielis »

schlemiel29 wrote: Tue Sep 19, 2023 10:30 am OK, that may be a long term solution. My question was, if I missed a detail or if I should use the function differently, because I never think, that I was the first one, who discovered an issue. :D If it is not a bug, but it is a feature, I can live with that.
Thanks Wim!
I would advise you to look into the code of the said Bedrock process and how it handles an empty value for that parameter.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Re: Bedrock delimiter

Post by schlemiel29 »

Hi Wim,
I already checked the code. It replaces an empty delimiter with a ";". That was the reason I asked, because I didn't want to change the original bedrock code.
lotsaram
MVP
Posts: 3698
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Bedrock delimiter

Post by lotsaram »

I think if you just comment out lines 90-92 on the prolog then this should suffice.

Code: Select all

If( pThousandSeparator @= '' );
 	pThousandSeparator = ',';
EndIf;
You can raise a ER at https://github.com/cubewise-code/bedrock/issues
The check for empty paramater and inserting a default makes sense. To achieve non-formatted numeric output I would prefer pThousandSeparator=BLANK to be converted to empty as a nicer solution.

For the better solution replace this starting at #253 of prolog

Code: Select all

If ( LONG(pThousandSeparator) = cLenASCIICode );
  nValid = 0;
  nChar = 1;
  While ( nChar <= cLenASCIICode );
    If( CODE( pThousandSeparator, nChar ) >= CODE( '0', 1 ) & CODE( pThousandSeparator, nChar ) <= CODE( '9', 1 ) );
      nValid = 1;
    Else;
      nValid = 0;
      Break;
    EndIf;
    nChar = nChar + 1;
  End;
  If ( nValid<>0 );
    pThousandSeparator = CHAR(StringToNumber( pThousandSeparator ));
  Else;
    pThousandSeparator = SubSt( Trim( pThousandSeparator ), 1, 1 );
  EndIf;
EndIf;
sThousandSeparator = pThousandSeparator;
with this

Code: Select all

If ( LONG(pThousandSeparator) = cLenASCIICode );
  nValid = 0;
  nChar = 1;
  While ( nChar <= cLenASCIICode );
    If( CODE( pThousandSeparator, nChar ) >= CODE( '0', 1 ) & CODE( pThousandSeparator, nChar ) <= CODE( '9', 1 ) );
      nValid = 1;
    Else;
      nValid = 0;
      Break;
    EndIf;
    nChar = nChar + 1;
  End;
  If ( nValid<>0 );
    pThousandSeparator = CHAR(StringToNumber( pThousandSeparator ));
  Else;
    pThousandSeparator = SubSt( Trim( pThousandSeparator ), 1, 1 );
  EndIf;
  sThousandSeparator = pThousandSeparator;
ElseIf( pThousandSeparator @= 'BLANK' );
  sThousandSeparator = '';
EndIf;
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Post Reply