Looking for example of adding data columns to a page.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 3 ans
I have setup a plugin to call an external service that returns a string with multiple fields/records contained within it.  Example - cust1-f1|cust1-f2|cust1-f3^cust2-f1|cust2-f2|cust2-f3^
Records are delimited by ^, fields are delimited by |
External service is our internal processing systems.  So I can control what is coming out of WSDL.

I want to parse data received and display in columns on page.
Currently running Nop 4.0

Could someone point me in the right direction please?  How to define columns in partial page?

Thank you,
Il y a 3 ans
You have to use String.Split() on view file to achieve this.

String.Split() method help you to get values into array and from array its easy to display ur data.
Il y a 3 ans
I put this code in controller -  
model.Success =
                new XElement("table",
                    model.TdataIn.Split('^')
                          .Select(pair =>
                              new XElement("tr",
                                  pair.Split('|')
                                      .Select(num => new XElement("td", num))
                              )
                     )
                ).ToString();

In the  view I have this -
<div>
            <table style="width:100%">
                <tr>
                    <th>Order #</th>
                    <th>PO Date</th>
                    <th>Cust #</th>
                    <th>Cust Name</th>
                    <th>Cust PO#</th>
                    <th>SKU</th>
                    <th>Description</th>
                    <th>QTY</th>
                    <th>Available</th>
                    <th>Due Date</th>
                    <th>Reqd</th>
                    <th>Rep Name</th>
                    <th>Rep Num</th>
                    <th>Entered By</th>
                    <th>Alt SKU</th>
                </tr>
            </table>
            @Model.Success

The model.Success has a " at both ends so the <tr><td> show rather than just the data.
What am I missing to get the data to show without the HTML tags?

Order #  PO Date  Cust #  Cust Name  Cust PO#  SKU  Description  QTY  Available  Due Date  Reqd  Rep Name  Rep Num  Entered By  Alt SKU
<table> <tr> <td>9999999</td> <td>04-10-20</td> <td>888888888</td> <td>xxx</td> <td>Chlhg</td> <td>99981</td> <
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.