Custom Table Transformation with conditional statements

Dominic Carvalho asked on January 11, 2019 09:16

Hey, I have built up a custom table with a list of country alias' and would like to loop through the table to check it against a variable I have available. I get the country alias from the custom table. for e.g.

if(CountryAlias == 'CA'){
    <html>
}else {
    <other html>
}

I am using a custom table repeater and I can display all CountryAlias I have in my table on the page I just can't get it to work with a condition.

  • How would I be able to dynamically check the values in a CountryAlias column from my custom table against a global variable and conditionally print html whether it returns true or false?*

And in my content before and after I have

<table> </table>

and in my transformation I have:

<tr>
    <td>{%CountryAlias%}</td>
</tr>

but it doesn't print the values in the specified transformation layout and doesn't print them in the content before and after. It just prints all the values on the page itself outside my content before and after.

  • Am I using the wrong custom table repeater ?

Any help would be greatly appreciated. Regards, Dominic

Correct Answer

Peter Mogilnitski answered on January 11, 2019 13:45

there are a few tranformation (acsx, macro, etc)types and syntax will be different for each of them. most likely you are using ACSX type syntax should be:

<tr>
    <%# Eval("CountryAlias") %>
</tr>

see acsx tranformation methods:

<asp:PlaceHolder runat="server" Visible="<%# Eval("CountryAlias") == 'CA'%>">
    <html>
</asp:PlaceHolder>
 <asp:PlaceHolder runat="server" Visible="<%# Eval("CountryAlias") != 'CA'%>">
    <other html>
</asp:PlaceHolder>   
0 votesVote for this answer Unmark Correct answer

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