Columns are getting repeated in Transformation

Nadeem khan asked on January 31, 2015 11:11

Hi,

I have written a transformation, where I want to display data like the below image:-

Image

The transformation which I have written is like below:-

<table class="tablestyle">
    <tbody>
        <tr>
            <th>
                <div style="width: 175px;">Job Work</div>
            </th>
            <th>
                <div style="width: 175px;">1st Responsible</div>
            </th>
            <th>
                <div style="width: 175px;">2nd Responsible</div>
            </th>
            <th>
                <div style="width: 175px;">Escalation</div>
            </th>
        </tr>
        <tr>
            <td><%# Eval("Job_Work") %></td>

            <td><%# Eval("First_responsible") %></td>

            <td><%# Eval("Second_responsible") %></td>

            <td><%# Eval("Escalation") %></td>
        </tr>
    </tbody>
</table>

But the issue is that, the columns are getting repeated as many times as the Rows is been added. Please see the below image for your reference:-

Error Image.

I am using Datalist to display data currently. Please help. Also. let me know if anything else is required

Correct Answer

Brenden Kehren answered on January 31, 2015 15:53

The transformation repeats a single row of data. So if your transformation is defining the header row in each row of data, you will end up with what you have now. You need to remove the <table> and <th> definition in your item transformation and place that in the content before and content after properties of the webpart. There are a few other things you could do as well but that by far is the most simple approach.

Content before:

<table class="tablestyle">
    <tbody>
        <tr>
            <th>
                <div style="width: 175px;">Job Work</div>
            </th>
            <th>
                <div style="width: 175px;">1st Responsible</div>
            </th>
            <th>
                <div style="width: 175px;">2nd Responsible</div>
            </th>
            <th>
                <div style="width: 175px;">Escalation</div>
            </th>
        </tr>

Item transformation:

        <tr>
            <td><%# Eval("Job_Work") %></td>
            <td><%# Eval("First_responsible") %></td>
            <td><%# Eval("Second_responsible") %></td>
            <td><%# Eval("Escalation") %></td>
        </tr>

Content after:

    </tbody>
</table>
4 votesVote for this answer Unmark Correct answer

Recent Answers


Nadeem khan answered on February 2, 2015 08:02

Hi Brenden, Thanks for the answer. Now I am getting the Header once only. See the image below:- Latest Image

But there is one Issue, I am still not able to get the three rows as expected. I have pasted the code in "Selected item transformation:" And the the way you suggested i have added the HTML code, in content Before and after. Please help

1 votesVote for this answer Mark as a Correct answer

Sandro Jankovic answered on February 3, 2015 10:18

Hello,

The single item transformation is displayed when you select an item from the main transformation property. Please try defining your transformation under the "Transformation" property and let us know if that does not work as expected. Also, please review the documentation for more details.

Best Regards,
Sandro

0 votesVote for this answer Mark as a Correct answer

Nadeem khan answered on February 3, 2015 10:28

Thanks for your reply Sandro,

I added as per your guidance, but still the data is not coming.

0 votesVote for this answer Mark as a Correct answer

Sandro Jankovic answered on February 3, 2015 11:24

Hello,

In the screenshots you initially provided the datalist seems to be showing data. Did you change the path to your files or the column names in the transformation? What exactly are the DataList settings? The control documentation may help you get started with the initial configuration.

Best Regards,
Sandro

0 votesVote for this answer Mark as a Correct answer

Nadeem khan answered on February 3, 2015 11:35

Actually, I did not gave the path in the content folder. Due to which it was not showing. Now I can see them.

Thanks a lot..!!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.