0

How do I select the first record which meets a condition

hi, I'm attempting to use a formula to pull the latest record from another table where a condition is met but I get a syntax error - I'm new so I expect this is an easy one but I can't figure it out! Any help would be appreciated  

first((select Signals).'Date / Time' where Pair = myPair)

4 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    Try this...

     

    first(select Signals where Pair = myPair).'Date / Time'

    • aussiemckenna
    • 4 yrs ago
    • Reported - view

    That was really helpful - thank you!  the only problem is it gives me the first record in chronological order when what I'm after is the latest....  I thought the answer might be the below but ninox doesn't seem to like the desc syntax.  Any ideas?  Thanks again!

     

    first((select Signals where Pair = myPair) order by 'Date / Time' desc).'Date / Time'

    • Sean
    • 4 yrs ago
    • Reported - view

    Sorry, I just focused on the syntax. If you want the latest, you would use last() instead of first().

     

    last((select Signals where Pair = myPair) order by 'Date / Time').'Date / Time'

     

    As far as I know Ninox does not allow "desc" when using "order by".

    • aussiemckenna
    • 4 yrs ago
    • Reported - view

    This was perfect. Thank you!

Content aside

  • 4 yrs agoLast active
  • 4Replies
  • 2008Views