Domanda

Per la seguente 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]
viene restituito

Il seguente:

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

Questo sta causando problemi, come si usa la stessa stringa di formato in .NET come un'operazione di post-processo (un certo controllo ci impone di farlo), e si comporta come previsto (moltiplicandolo per 100 perché il segno%) .

E 'questo comportamento documentato? O qualche oscuro bug? O sto facendo qualcosa di sbagliato / strano? Sento il membro testPrepend dovrebbe essere moltiplicato per 100, ma non è.

È stato utile?

Soluzione

comportamento documentato sembra implicare il metodo dovrebbe funzionare: http: // msdn .microsoft.com / en-us / library / ms146084.aspx

  

Rappresenta una percentuale segnaposto.   L'espressione viene moltiplicato per 100.   È inserito il carattere percentuale (%)   nella posizione in cui la percentuale   appare nella stringa di formato.

Ho provato con grandi numeri, per assicurare la maschera è pieno, sembra proprio di ignorare il simbolo di percentuale se è il primo carattere? Forse sollevarlo con 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]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top