вторник, 5 мая 2015 г.

How to get string value with coma in View Dax 2012

Hello everyone!
Today I want to share with you some useful information.
I had a task:
get the value from table1 and bring them into one string with coma separator.
First I wanted to use display method, but display methods don't work in Views.
And I wrote the query for String Computed column, that returns the correct string value, which I needed.
Here's the code:

public static server str getLiveUserIdValue()
{
    str     curRecId = SysComputedColumn::returnField(tableStr(table), identifierStr(table), fieldStr(table, field));
    return '(select STUFF((select \',\'+ UserId from table where table.recid='+curRecId+' for xml path(\'\')), 1,1, \'\') as lst )';
}

This code hepled me to return correct value.
Hope, it'll be usefull for someone! 

Комментариев нет:

Отправить комментарий