0

Need to Match show rows from a table if email field matches

Hello and good day!

I have a table called "Events" where I record emails from or to different Contacts.

I have a table called "Contacts" and I'm adding a view to this table where I want to show "Events" just if the fields EmailFrom or EmailTo are = to the Contacts table field called "WorkEmail".
I used the formula as shown in the screen but it is not recognizing the field "WorkEmail" which is available in the "Contacts" table:

 

Screen Shot 2021-06-07 at 10.46.36

 

I tried changing the formula to:

select Events where EmailTo or EmailFrom = (select Contacts).WorkEmail and it work, but i showing all Events that have a Contact = WorkEmail without filtering.

I need to show in Contacts only the Events where EmailFrom or EmailTo are equal to this specific contact WorkEmail.

Can please anyone help?

9replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Fabio
    • noCodeApp
    • Fabio
    • 1 yr ago
    • Reported - view

    Hi Predro. Try this:

    ---

    let me := this;

    select Events where EmailTo or EmailFrom = me.WorkEmail

    ---

       Fabio

    Like
    • Fred
    • Fred
    • 1 yr ago
    • Reported - view

    a bit of background to Fabio's great suggestion:

     

    Your code was just missing a way for Ninox to access the current record you are in. Thus the first line of code is to tell Ninox to take the data from the current record (this) and put it in a variable (me). Then you can use the variable in your select statement and access the fields from the current record.

    Like
    • Pedro
    • Pedro
    • 1 yr ago
    • Reported - view

    Hello Fabio and Fred!
    Thanks for the assistance and help; I tried the code and the syntax is great but still the view is showing emails from the contact, but also showing other e-mails too.
    See the red arrow, where the email was not supposed to be listed, below:

    Screen Shot 2021-06-07 at 12.48.33

    Like
    • Pedro
    • Pedro
    • 1 yr ago
    • Reported - view

    In fact I just checked, all Contacts are showing the same list; maybe the "me" := This is not been recognized?
    This feature is very important for my project; I truly appreciate your kind help.

    Like
    • Fred
    • Fred
    • 1 yr ago
    • Reported - view

    Please double check the record for 20 Apr 2021, 05:08 to see that the email address is not in either Emailto or EmailFrom.

    Like
    • Fred
    • Fred
    • 1 yr ago
    • Reported - view

    Are you using email fields or text fields for EmailTo and EmailFrom?

    Like
    • Pedro
    • Pedro
    • 1 yr ago
    • Reported - view

    Hi Fred!
    Just checked and no; there is no repeating or associated emails in the fields that may be filtering to the same message.
    I double checked all records.

    Like
    • Fred
    • Fred
    • 1 yr ago
    • Reported - view

    I was wondering if your code was correct but it isn't. Please change it to:

     

    select Events where EmailTo = me.WorkEmail or EmailFrom = me.WorkEmail

     

    You were basically saying if EmailTo equal anything.

    Like
    • Pedro
    • Pedro
    • 1 yr ago
    • Reported - view

    Fred, it works!
    Thanks a lot for your assistance and support!
    Wish you a great day, thank you!!!

    Like
Like Follow
  • 1 yr agoLast active
  • 9Replies
  • 324Views