Mdx format_string для % не умножается на 100, когда знак %

StackOverflow https://stackoverflow.com/questions/2241492

  •  19-09-2019
  •  | 
  •  

Вопрос

Для следующего запроса:

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, но это не так.

Это было полезно?

Решение

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]
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top