Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Crosstab - concatenate string
jbaron
<p>Hi everybody,</p>
<p> </p>
<p>I have a crosstab group by user. One user can have mutiple tasks. Each task contains a company name.</p>
<p>I need to create a new column which contains the concatenation of all companies. Is it possible ?</p>
<p>I can display only the first or last company name.</p>
<p> </p>
<p>Thanks in advance,</p>
<p> </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>Maybe this recent <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/39430-concatenating-multiple-string-values-for-a-summary-field-in-cross-tab/'>post
</a>will help. It was for a case where strings needed to be concatenated in a crosstab cell. </p>
<p> </p>
<p>If that doesn't help, please provide some sample data and a mock up of the expected result.</p>
<p> </p>
<p>regards,</p>
<p> </p>
<p>P.</p>
jbaron
<p>Hi Pierre,</p>
<p> </p>
<p>many thanks for your reply. I fell I'm on the right track.</p>
<p>I have still an issue. I need to create a company name by user and by months. I have a strange result with this expression :</p>
<div>if (vars["groupCol"] != row["nom_prenom"]) {</div>
<div>vars["measure"] = row["company_name"]</div>
<div>vars["groupCol"] = row["nom_prenom"]</div>
<div>} else {</div>
<div>vars["measure"] = vars["measure"] + ", " + row["company_name"]</div>
<div>}</div>
<p>vars["measure"]</p>
<p> </p>
<p>I attached my designed screenshot, maybe you can help me again :-)</p>
<p> </p>
<p>Thanks in advance, </p>
pricher
<p>Hello,</p>
<p> </p>
<p>What is the "strange result" you are getting? Can you attach your report design?</p>
<p> </p>
<p>P.</p>
jbaron
<p>Hello, </p>
<p> </p>
<p>I said strange result, because client don't have the correct value. For example, for the user "Arnaud Demu" for the august month (2016), I need to see CLIENT29 and CLIENT30. Something is wrong with my code. </p>
<p> </p>
<p>Many thanks for your help.</p>
<p> </p>
<p>Julien</p>
pricher
<p>Can you also send the data file?</p>
jbaron
<p>Of course, sorry for this oversight.</p>
pricher
<p>In my example, I tested only on COUNTRY to determine if I had to concatenate the CITY value. In your case, there is also a date dimension, so you need to test as well on username and date.</p>
<p> </p>
<p>Because I couldn't use directly your data file (the dated in French did not load as dates in my English version of BIRT..), I created a new example based on Classic Models. This time, the concatenation happens whenever COUNTRY or DATE changes. Two caveats: 1) you need to have a "date" column that computes the lowest date level you need in your crosstab (e.g. Year + month); 2) the data needs to be sorted by Username and date.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
jbaron
<p>Hello,</p>
<p> </p>
<p>I have still an issue. I create a new excel file with some sample data in english format for you.</p>
<p>Maybe you can help me again ;-) </p>
<p>Fo exemple, for this month, clients should be CLIENT29 & CLIENT30, I see only CLIENT30. I don't know why. Do you have an idea ? </p>
<p> </p>
<p>Thanks in advance,</p>
<p> </p>
<p> </p>
<p>Julien </p>
pricher
<p>Hi,</p>
<p> </p>
<p>As I mentioned in my previous post, the data needs to be sorted correctly for the computed column to be created properly. In your case, the data needs to be sorted by "nom-prenom" and "YM". If you look at these 4 rows of the excel spreadsheet you sent me, the data is not sorted correctly for YM; therefore, the variable "groupCol" will be reset before it could concatenate CLIENT29 to the string.</p>
<p>
jbaron
<p>you're right, but now for YM I change the process. It's a calculated field (BirtDateTime.year(row["YMD"])+BirtDateTime.month(row["YMD"])), integer type. The column is sorted. But for the client the result is the same. </p>
<p> </p>
<p> </p>
pricher
<p>You don't need to create the YM_11 computed column. The data you have in the Excel file is not sorted correctly to work with the logic needed to create the Clients computed column. If the data in column YM is not sorted, you will not be able to concatenate the strings for each occurrence of group Username/YM. </p>
<p> </p>
<p>I am sending you a new Excel file. On the second sheet, I have copied and pasted the data for user Arnaud Demu and resorted the set on column YM. When I use the data from that sheet in the report you sent me, it works!</p>
<p> </p>
<p>P.</p>
jbaron
<p>haaaaa, I understand now! We don't talk about the same coulmn. It's YMD not YM, which need to be sorted. </p>
<p>So it's working perfect now if I sort the column in excel file. Do you know if it's possible to sort the input data in birt ? </p>
<p>I will use a webservice to get the data sort by id.</p>
<p>Thank you very much.</p>
<p> </p>
<p>Julien </p>
pricher
<p>The data needs to be sorted by the web service. In BIRT, you can sort at the table level, but not at the dataset level. Since the computed column is created at the dataset level and requires data to be sorted by username and date, your web service will need to output the rows in the correct order.</p>
<p> </p>
<p>P.</p>
jbaron
<p>Thank you for all your assistance ;-)</p>
jbaron
<p>Hello Pierre,</p>
<p> </p>
<p>I have two news blocking points in this report. Maybe you can help me.</p>
<p>- I would like to hide a colum in the cross tab. With javascript I can do it (display none on th and td) but there is a lag in the table. The first column to the next month is the current month. </p>
<p> </p>
<p>- I would like to add a grand total row, but not an all columns, for the customer I don't want to apply the total (and it's a string). The grand total function apply automatically the total for all fields even I revome some total fields.</p>
<p> </p>
<p>Do you have an idea for this points ?</p>
<p> </p>
<p>Thank in advance,</p>
<p> </p>
<p>Julien </p>