if else on type of interger

Discussion in 'ASP General' started by Simon, Oct 22, 2004.

  1. Simon

    Simon Guest

    Hi there

    I know I should be able to do this, but I'm stuck!

    I am trying to build a table that forms from cats being pulled from a DB.

    The table will be 3 cols by x rows.

    I have been doing an if else based on if int(Ident/3)= 1, 2, 3, 4 etc etc ,
    but this is sloppy! :-(

    What I need to get working is

    <%

    Code Snipped

    if int(Ident/3)= [a whole number] then

    %>
    formatting A is done
    <% else %>
    formatting b is done
    <%
    end if

    Code Snipped

    %>

    Thanks in advance

    Si
    Simon, Oct 22, 2004
    #1
    1. Advertising

  2. Perhaps you are looking for the mod[ulus] operator, although it wouldn't be
    much different from what you're doing now. What exactly isn't working for
    you in the way you want it to?

    If Ident Mod 3 Then
    'formatting a
    Else
    'formatting b
    End If

    http://msdn.microsoft.com/library/en-us/script56/html/vsoprmod.asp

    Ray at work





    "Simon" <> wrote in message
    news:rs6ed.133939$...
    > Hi there
    >
    > I know I should be able to do this, but I'm stuck!
    >
    > I am trying to build a table that forms from cats being pulled from a DB.
    >
    > The table will be 3 cols by x rows.
    >
    > I have been doing an if else based on if int(Ident/3)= 1, 2, 3, 4 etc etc
    > ,
    > but this is sloppy! :-(
    >
    > What I need to get working is
    >
    > <%
    >
    > Code Snipped
    >
    > if int(Ident/3)= [a whole number] then
    >
    > %>
    > formatting A is done
    > <% else %>
    > formatting b is done
    > <%
    > end if
    >
    > Code Snipped
    >
    > %>
    >
    > Thanks in advance
    >
    > Si
    >
    >
    Ray Costanzo [MVP], Oct 22, 2004
    #2
    1. Advertising

  3. Ray Costanzo [MVP] wrote:
    > If Ident Mod 3 Then
    > 'formatting a
    > Else
    > 'formatting b
    > End If


    That ought to be:

    If Ident Mod 3 = 0 Then
    ^^^^^


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, Oct 22, 2004
    #3
  4. Oh yeah. Thanks. :]

    Ray at work

    "Dave Anderson" <> wrote in message
    news:...
    > Ray Costanzo [MVP] wrote:
    >> If Ident Mod 3 Then
    >> 'formatting a
    >> Else
    >> 'formatting b
    >> End If

    >
    > That ought to be:
    >
    > If Ident Mod 3 = 0 Then
    > ^^^^^
    >
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message.
    > Use
    > of this email address implies consent to these terms. Please do not
    > contact
    > me directly or ask me to contact you directly for assistance. If your
    > question is worth asking, it's worth posting.
    >
    >
    Ray Costanzo [MVP], Oct 22, 2004
    #4
  5. Simon

    Simon Guest

    Excellent, Thanks for that.

    I worked around it by doing

    if int(Ident/cellCount) - Ident/cellCount = 0 then

    which worked, but .... now

    RowBreak = Ident Mod cellCount

    if RowBreak = 0 then

    Works and is a lot cleaner

    Thanks again.

    Si
    Simon, Oct 22, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    Cannot be converted to 'Interger'

    =?Utf-8?B?VGltOjouLg==?=, Nov 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,646
    chanmmn
    Nov 3, 2004
  2. uvbaz
    Replies:
    6
    Views:
    7,476
    uvbaz
    Sep 12, 2006
  3. I_have_nothing

    Any easy to printf an interger in 9,999, 99 format?

    I_have_nothing, May 13, 2005, in forum: C Programming
    Replies:
    4
    Views:
    392
    Chris McDonald
    May 13, 2005
  4. heng
    Replies:
    3
    Views:
    325
    Steven T. Hatton
    Dec 6, 2006
  5. Tim Slattery
    Replies:
    2
    Views:
    402
    Pete C
    Jan 6, 2007
Loading...

Share This Page