Results 1 to 4 of 4

Thread: iif problem

  1. #1
    Member
    Join Date
    Jan 2014
    Location
    Netherlands, Middelburg
    Posts
    34

    iif problem

    what is wrong with:

    lrundvlees = .f.
    ? lrundvlees
    .F.

    grondstoffen.rundvlees = .t.
    ? grondstoffen.rundvlees
    .T.

    iif(grondstoffen.rundvlees = .t.,lrundvlees = .t.,lrundvlees = .f.)
    ? lrundvlees
    .F.

    why is lRundvlees not .T. ?

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,199
    Blog Entries
    22
    Hi Leon,

    IIF() is a function that returns the result of an expression.

    If the first expression is true it returns the second otherwise the third.

    lrunvlees = iif(grondstoffen.rundvlees = .t.,lrundvlees = .t.,lrundvlees = .f.)
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,187
    Boy, that's a headful.

    What is amounts to in this case is:

    lrundvlees = (grondstoffen.rundvlees and lrundvlees) or (!grondstoff.rundvlees and !lrundvlees)

    I don't know if that was the intent, but that's what the logic says in this case.

    I wouldn't have thought to do that in an IIF, and it works nicely.

    Hank

  4. #4
    Member
    Join Date
    Jan 2014
    Location
    Netherlands, Middelburg
    Posts
    34
    Hi Barry,

    my head is still thinking VFP, this was code i use in the old program for my company recipes.
    thx for your reply it now works fine;

    lrundvlees = .f.
    ? lrundvlees
    .F.

    recepturen!grondstoffen.rundvlees = .t.
    ? grondstoffen.rundvlees
    .T.

    lRundvlees = iif(grondstoffen.rundvlees = .t., .t., .f.)
    ? lrundvlees
    .T.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us