Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ian Bradbury 2 posts 82 karma points
    May 11, 2016 @ 15:01
    Ian Bradbury
    0

    Counting`

    Hello.

    I am new at this so apologies if this is toooo simple. I've searched and searched but can't seem to find an answer.

    I am trying to do something like this....

    var c = @row.areas.Count;
    var cl = "section";
    if(@c == 3) {
        @cl = "sectionNarrow";
    }
    

    If I output the variables c and cl are fine until I do the if

    Help!

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 11, 2016 @ 18:52
    Jeavon Leopold
    100

    Hi Ian,

    Try this:

    var c = (int)row.areas.Count;
    var cl = "section";
    if(c == 3) {
        cl = "sectionNarrow";
    }
    

    As you are using dynamic variable it needs to be cast to int.

    Jeavon

  • Ian Bradbury 2 posts 82 karma points
    May 13, 2016 @ 08:23
    Ian Bradbury
    0

    Bingo!

    Thanks. I was so close.... this works a treat.

Please Sign in or register to post replies

Write your reply to:

Draft