1

Trigger After Open

I use this trigger:

 

if ninoxApp() = "iphone"then openTable("TableName", "PhoneView")

else if ninoxaApp() = "mac" then openTable("TableName, "MacView")

 

I want when the Table opens to go to last record (maximum Id).

 

I tried with popupRecord inside the trigger with no luck.

 

Can this be done?

 

Nick

11 replies

null
    • Sean
    • 5 yrs ago
    • Reported - view

    I could get it to work with openRecord() if I entered the Id # of the last record, but that isn't what you're looking for. It would be nice to be able to use last(Id) for the record #. Feature request!

     

    Quite a contrast between the response you got and the response for this thread...

    https://ninoxdb.de/en/forum/technical-help-5ab8fe445fe2b42b7dd39ee7/web-link-to-specific-table-within-database-5c37212876d53e397ca94ca1

    • Nick
    • 5 yrs ago
    • Reported - view

    OK, I came up with this code:

    ***

    if ninoxApp() = "mac" then
    openTable("General Journal", "All")
    else
    if ninoxApp() = "iphone" then
    openTable("General Journal", "Phone")
    end
    end;
    let maxId := last(select 'General Journal').Id;
    openRecord(record('General Journal',maxId))

    ***

     

    This action selects the last record in the table and popups the last record in the form but in the table view (what I see on screen) does not navigate to the bottom of the table.

     

    Nick

    • Sean
    • 5 yrs ago
    • Reported - view

    Good work. I tried something similar, but didn't use the select command. It does navigate to the correct record in table view, but it doesn't update the view to show it.

    • Nick
    • 5 yrs ago
    • Reported - view

    Exactly! Thank you Sean for writing my text better...

     

    Nick

    • Sean
    • 5 yrs ago
    • Reported - view

    😎  I'm not trying to upstage the work you did here... You can also use the formula used for maxId directly in openRecord() if you want.

    • Nick
    • 5 yrs ago
    • Reported - view

    Thanks again!

    • Nick
    • 5 yrs ago
    • Reported - view

    Update:

    It doesn't update the view to show the correct record when it runs from "Trigger after Open".

    The same code works fine (updates the view) when assigned to a button e.g. on a Dashboard table.

    • Sean
    • 5 yrs ago
    • Reported - view

    Nick, I'm confused. Are you using it differently now than before? It still works for me.

    • Nick
    • 5 yrs ago
    • Reported - view

    Sean, I'm looking for a workaround to update the view to the last record. I thought I found a solution, but it's not working.

    So, ignore my previous post... Sorry!

    • Nick
    • 5 yrs ago
    • Reported - view

    Correction:

    ... I'm looking for a workaround to update the view to the last record in table view.

    • Sean
    • 5 yrs ago
    • Reported - view

    No worries, I think that behavior might have to be fixed by the Ninox Team.

Content aside

  • 1 Likes
  • 5 yrs agoLast active
  • 11Replies
  • 5089Views