Macro to run for my collection list

 
  • Hello experts,

    I have a macro which collects all 'REST' under zone level and fills certain attributes, purposes for the 'REST' perfectly.

    My question is
    instead of the whole ZONE, I have collected a separate list of 'REST' for which this macro has to run for that particular list alone

    so how to run that macro for the collected list?
    what additionally has to be added along with the macro i have?

    I mean , if we store the collected list, then in the Macro, instead of CE, I put that storage variable and I will run the macro.

    I hope you can understand my question.
    Expecting your answers

    Thanks
  • Hello,

    If I understand, you need to get the content of a collection (Array of Dbref) in E3D.

    Here is a code using MyDataAddin to get the content of a collection using its name:

    import 'MyDataAddin'
    handle (1000,0)
    endhandle

    using namespace 'AVEVA.Core.Presentation.MyDataAddin'
    !myData = OBJECT PMLMYDATA()


    q var !myData.elementsInCollection('MyCollection')


    Where 'MyCollection' is to replace by the name of your collection.

    The MyDataAddin API, if needed:
    https://help.aveva.com/AVEVA_Everything3D/3.1/wwhelp/wwhimpl/js/html/wwhelp.htm#href=NCUG/NCUG7.10.2.html
  • Hello dear Citron !

    In your screenshots you seem to use "My Collection 1" while the name of your collection is "New Collection1".
  • Hi L,
    Thanks for your reply

    As i said, this macro runs under ZONE level perfectly. Bcz the macro begins with
    '''
    Var !rest coll all (rest) with (mcount Gt 0) for ce
    Do !i indices !rest
    If (stlref of $!rest[$!i] NE nulref ) then
    $!rest[$!i]

    etc'''''
    it goes on

    Here 'ZONE' is the CE. Everytime i run it under zone level, it runs fully under that zone.
    But now, as per ur code, we have collected the list of 'REST' and i don't want to include that collected REST in separate zone.

    So, in macro, instead of CE, What will come on the first line. I mean how to put the stored variable? so that the macro runs for the collected list.

    I hope i have explained clearly i think, if not please inform?
  • Hello Arunkumar,

    Assuming your macro works like this currently:

    [COLOR=#3E3E3E]Var !rest coll all (rest) with (mcount Gt 0) for ce[/COLOR]
    [COLOR=#3E3E3E]Do !i indices !rest[/COLOR][INDENT][COLOR=#3E3E3E]-- Your code here[/COLOR][COLOR=#3E3E3E]
    [/COLOR][/INDENT]
    [COLOR=#3E3E3E]Enddo[/COLOR]


    You can get your collection result, and use it like this:

    import 'MyDataAddin'
    handle (1000,0)
    endhandle

    using namespace 'AVEVA.Core.Presentation.MyDataAddin'
    !myData = OBJECT PMLMYDATA()

    !collectionResult = !myData.elementsInCollection('MyCollection')
    Do [COLOR=#3E3E3E]!i indices ![/COLOR]collectionResult[INDENT]-- Your code here[/INDENT]
    Enddo