Results 1 to 7 of 7

Thread: Iif

  1. #1

    Thread Starter
    Fanatic Member SkiNLaB's Avatar
    Join Date
    Jan 2002
    Location
    Sydney, Australia
    Posts
    747

    Iif

    IIf(Booking Is Nothing, "Null", Booking.BookingID)

    Booking is an object

    and i wish to put its BOOKING id in sql string i am building

    and this IIF looked to do the job quite nicely in a compact and neat way.

    but nooo it HAS to evaluate booking.bookingid regardless it booking is nothing or not! (resulting in an error if it is nothing)

    doesnt that suck!

    what do u think.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Yeah, well, that's the nature of subs/functions. All expressions are evaluated before being passed into the procedure. You'll find the same issue with any function.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Fanatic Member SkiNLaB's Avatar
    Join Date
    Jan 2002
    Location
    Sydney, Australia
    Posts
    747
    Originally posted by crptcblade
    Yeah, well, that's the nature of subs/functions. All expressions are evaluated before being passed into the procedure. You'll find the same issue with any function.
    yeah but i just wanted to whinge

    p.s.

    regarding ur sig DAS HUGE!

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by SkiNLaB
    regarding ur sig DAS HUGE!
    I know, I know...but I can't bring myself to change it.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857

    Re: Iif

    Originally posted by SkiNLaB
    IIf

    doesnt that suck!

    what do u think.
    Yes! I finally found a use for Ilf in one of my programs this past week. It worked out great but even Microsoft warns of its use in MSDN. You definatly have to be careful because of how it evalutes both expressions it is testing!
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

  6. #6
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You think IIf is bad, start using Switch, where you have a a whole lot of params you can pass in and screw up on.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7

    Thread Starter
    Fanatic Member SkiNLaB's Avatar
    Join Date
    Jan 2002
    Location
    Sydney, Australia
    Posts
    747
    /me endeavours to use switch in the near future

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width