当 % 符号位于前面时,% 的 MDX format_string 不会乘以 100

发布于 2024-08-21 05:38:47 字数 683 浏览 2 评论 0原文

对于以下查询:

with 
member testVal as 0.1234
member testNormal as testVal
member testPrepend as testVal, format_string="%##.00"
member testMidpend as testVal, format_string="##%.00"
member testAppend as testVal, format_string="##.00%"
select { testNormal, testPrepend, testMidpend, testAppend} on axis (0)
from [SomeRandomPlace]

返回以下内容:

testNormal  testPrepend     testMidpend     testAppend
0.1234      %.12            12%.34          12.34%

这会导致问题,因为我们在 .NET 中使用相同的格式字符串作为后处理操作(某些控制要求我们这样做),并且它的行为符合预期(将其乘以100 因为% 符号)。

这是有记录的行为吗?还是一些不起眼的错误?或者我做错了什么/奇怪的事情?我觉得 testPrepend 成员也应该乘以 100,但事实并非如此。

For the following query:

with 
member testVal as 0.1234
member testNormal as testVal
member testPrepend as testVal, format_string="%##.00"
member testMidpend as testVal, format_string="##%.00"
member testAppend as testVal, format_string="##.00%"
select { testNormal, testPrepend, testMidpend, testAppend} on axis (0)
from [SomeRandomPlace]

The following is returned:

testNormal  testPrepend     testMidpend     testAppend
0.1234      %.12            12%.34          12.34%

This is causing issues, as we use the same format string in .NET as a post-process operation (some control requires us to do this), and it behaves as expected (multiplying it by 100 because of the % sign).

Is this documented behaviour? Or some obscure bug? Or am I doing something wrong/weird? I feel the testPrepend member should also be multiplied by 100, but it's not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满身野味 2024-08-28 05:38:47

记录的行为似乎暗示您的方法应该有效:http://msdn.microsoft。 com/en-us/library/ms146084.aspx

代表百分比占位符。
该表达式乘以 100。
插入百分号字符 (%)
在百分比所在的位置
出现在格式字符串中。

我已经尝试过使用更大的数字,以确保填充掩码,如果它是第一个字符,它似乎会忽略百分比符号?也许可以通过 MS Connect 提出?

with 
member testVal as 13.1234
member testNormal as testVal
member testFront as testVal, format_string = "%##.00"
member testFrontBack as testVal, format_string = "%##.00%"
member testString as testVal, format_string="Percent"
member testSymbol as testVal, format_string="%"
member testStringSymbol as testVal, format_string="%Percent" //Lol
select { testNormal, testFront, testFrontBack, testString, testSymbol, testStringSymbol} on axis (0)
from [Cube]

Documented behaviour seems to imply your method should work: http://msdn.microsoft.com/en-us/library/ms146084.aspx

Represents a percentage placeholder.
The expression is multiplied by 100.
The percent character (%) is inserted
in the position where the percentage
appears in the format string.

I've tried it with larger numbers, to ensure the mask is filled, it just seems to ignore the percentage symbol if it is the first character? Maybe raise it with MS Connect?

with 
member testVal as 13.1234
member testNormal as testVal
member testFront as testVal, format_string = "%##.00"
member testFrontBack as testVal, format_string = "%##.00%"
member testString as testVal, format_string="Percent"
member testSymbol as testVal, format_string="%"
member testStringSymbol as testVal, format_string="%Percent" //Lol
select { testNormal, testFront, testFrontBack, testString, testSymbol, testStringSymbol} on axis (0)
from [Cube]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文