0

Trigger after open problem

I'm trying to do simple switch, but it looks like i cannot select database...

select("Influencers")   -----> without this i got "Field not found", but with i got an error of "identifier exepted"
Status := if To > today() or To = today() then
        true
    else
        false
    end;
    end

5 replies

null
    • Bartosz_Polinski
    • 1 yr ago
    • Reported - view

    OK i solved it by myself ;)

    select'Influencers'.Status:= if To > today() or To = today() then
            true
        else
            false
        end

    • Fred
    • 1 yr ago
    • Reported - view

    Congrats on finding the solution.

    You can also write it like this:

    select'Influencers'.Status:= if To >= today() then
            true
        else
            false
        end
    
      • John_Halls
      • 1 yr ago
      • Reported - view

      Fred Hi Fred. I didn't think you could assign a value via a select statement without looping through the elements, or using first, last. It does work but it can generate some odd results. The following script

      let a := select Test;
      a.Text := a.Text + "s"

      used over four records with initial values for Text of "a", "b", "c", and "d" would expect to generate "as", "bs", "cs", and "ds", but instead it generates "abcds", "abcdsbcds", "abcdsabcdsbcdscds", and "abcdsabcdsbcdsabcdsabcdsbcdscdsds".

      Interesting!

      Regards John

      • Fred
      • 1 yr ago
      • Reported - view

      I was wondering how it would handle multiple records, but  said it worked so I trust his response. I was just showing how you can use the >= instead of do separate comparisons.

      • John_Halls
      • 1 yr ago
      • Reported - view

       Thanks Fred. Yes it does if it directly replaces the existing value like this

      let a := select Test;
      a.Text := "s"
      

      but produces odd results when interacting with the existing value.

Content aside

  • 1 yr agoLast active
  • 5Replies
  • 54Views
  • 3 Following