0

Syntax stupid question

Hi, for sure will be a stupid thing but I can't figure out where I'm wrong in the syntax of this formula. Can anyone help me please? Thanks

6 replies

null
    • John_Halls
    • 2 yrs ago
    • Reported - view

    I'm wondering if you need to bracket the boolean logic

    select Jobs where Stato = 2 and 'Stato lavorazione FOTO' = 4 and ( 'Stato Album' = 1 or 'Stato Album' = 3 or 'Stato Album' = 4 )
    
    

    and I don't think you should have a  select statement wrapped within an if statement in a view, better to put this in Display field only, if:

    'Gestione album' = 3

    Regards John

    • Fred
    • 2 yrs ago
    • Reported - view

    You can try:

    select Jobs where Stato = 2 and 'Stato lavorazione FOTO' = 4 and 'Stato Album' =1 or 'Stato Album' = 3 or 'Stato Album' = 4
    

    No need to repeat the first two since they are the same.

      • giuseppe
      • 2 yrs ago
      • Reported - view

      Fred Thank you but it doesn't work. Only the last condition occurs "'Stato Album' = 4"

    • Fred
    • 2 yrs ago
    • Reported - view

    I was wrong. I just tried it out and your first code is correct.

    Looking at it again, you have selected records in Jobs that match your search parameters but you don't tell Ninox what do with it.

    If you take the select statement and put it in a formula field, Ninox will not display anything. Even though it has gone and found the records. To see it, take the select statement and put it in a variable then do a concat.

    let x := (select Jobs....)
    concat(x)
    

    You could make it one line but with your long select statement it can be hard to read. You will now see the record Ids of the found set. This is only for testing. You don't need to concat in your final code, unless that is what you want.

    So you have to decide what you want Ninox to do with the found set. Do you want to count? sum? avg? concatenate? This can also apply to a specific field in the found set.

    • giuseppe
    • 2 yrs ago
    • Reported - view

    Thanks Fred, surely I was wrong because I have not entered all the information. This formula is for a view that shows only the records that meet the required parameters. So in this case the result is the display of those records

    • Fred
    • 2 yrs ago
    • Reported - view

    Does the select work in view by itself?

    maybe the if statement doesn’t return true?

Content aside

  • Status Answered
  • 2 yrs agoLast active
  • 6Replies
  • 125Views
  • 3 Following