Recalling Last Association in Plant SCADA 2023 R2

hi, i have a page that has four buttons that associates different tags in the same page, and this page have a main button in the footer that opens it, but i want the page to recall the last association when i press on the main footer button, can anyone help with this?

Parents
  • If you're just associating a different tag with the current page, you have to re-display the page with the PageDisplay() function for the new associations to take effect. Here's a clip from the help:

    Ass(hWin, nArg, sTag, nMode [, sClusterName] )

    hWin:

    The association will be created for the next Super Genie to display in the window specified here; enter the window number or:

    -3 - for the current window when the page is changed. The page can be changed by using the Page Cicode functions like PageDisplay, PageGoto, etc.

  • To Be More Clear, The button used to open the page is a genie, and it have alot of inputs and these %inputs% are being used in metadata to associate to my page, so these 4 buttons do the association of so many tags to the page, and there is a main button that navigates to this page, so the thing is i want the main button to recall the last association that happened to my page, and then re-associates it again.

    thank you so much in advance.

  • Sounds like you're looking for the PageTask() function. You specify a Cicode function name, and a list of arguments to pass to the function that will associate the required tags and display the page. The benefit of using PageTask() is that it saves the function name/args in the recent pages queue, instead of just the page name. Then, if you try to browse back to a recently-displayed page, such as with the PageLast() command, it re-runs the specified function to redisplay the page with the same associations.

    The difficult part may be to get your list of associations to fit into a single string value. For example, if your genie has metadata associations like %prefix%_prop1, %prefix%_prop2, etc., then you could change it to just pass %prefix% to a custom Cicode function, and that function would do the association of each of the properties using that prefix.

    The association function arguments to pass to PageTask() have to be combined into a single string, with quotation marks replaced with ^". See the TaskNew() help page for an example of how to do that.

Reply Children
No Data