Clusters in Menu

Maybe I'm just having a brain cramp here.

Ran into a situation where I need different pages on the menu depending which cluster I am in.

I put an "IF" statement in the menu command line, which works fine as long as I don't change clusters.

With an unclustered reference, the tag value remains with the first cluster after the project has been started up.

How do I get the tag to follow the current cluster?


A little further information - page changes between software revisions - I am trying to avoid having to load a new project every time the project revision changes.  A tag in the PLC contains the revision number.

  • Hi Mike,

    I tried this out and also found that tags with no cluster prefix in menu commands do not use the cluster context of the current page. TaskCluster() didn't return anything when called from a menu command. However, PageInfo(26) did correctly return the cluster.

    I used PageDisplay("pagename","clustername") to switch the cluster context on the page to a different cluster and PageInfo() still worked in the menu command.

    So, I tried TagRead("tagname", 0, PageInfo(26)) from a menu command and it correctly read the tag. Could you use a command like PageDisplay("pagename_" + TagRead("VerNo", 0, PageInfo(26)):#)

    If that's not what you're trying to do, could you give us more information?

    What version of Citect is it? I tested in 2018R2, but I would expect the same operation in v7 and v8.

    How are you changing clusters? Are you specifying the cluster in the PageDisplay() command, in the page properties (Cluster Context), inheriting from the previous page, or another method?

    Can you share an example of your menu command? I wasn't clear if you were using the page, hidden, or cluster fields or just the Level and Command fields.
  • 2018 or version 8. Patch 30.

    menu command is:
    IF U_SW_VER_PV < 9 THEN WinNew("CHASSIS") else WinNew("CHASSIS_II") END

    (actually, the WinNew is in a wrapper function, and that is where the cluster gets assigned.)
    Each of the calls works flawlessly - calling the correct page.
    Pages are intentionally left without cluster context so it can ba assigned when called.

    U_SW_VER_PV is what is not getting updated predictably.
    I have a tag that keeps track of the cluster, so TagRead would likely work.
    Hence,
    IF (TagRead(U_SW_VER_PV,0,ClusterName) < 9 THEN WinNew("CHASSIS") else WinNew("CHASSIS_II") END
    should work (where ClusterName is a local variable that stores the Cluster Name).

    Mike
  • Sounds good. You may have to do StrToInt(TagRead(xxx)) since TagRead returns a string.