collection or list into 'My data' collection

 
  • Hi, is there any simple way to convert my collection or list that I read from .txt file into 'My Data' collection in PDMS? Or maybe to add My data colletion contents by command from drawlist, that would be helpful too.
    I can't really make a GADD command into GPSET cause of some stupid Global DB restrictions.


    !filepath = object file ('D:\MYDATA.txt')

    !readfilenames = !filepath.ReadFile()

    do !q val !readfilenames

    var !namefromfile coll all equi for $!q

    do !name values !namefromfile

    var !equiname append NAME OF $!name

    enddo

    enddo

    !!CDCLIST.list.dtext = !equiname

    handle any

    endhandle
  • !!mydata.addElements(!equiname)
    This is from E3D documentation (not tested)
  • unfortunately error occures
    (2,751) Variable !!mydata does not exist
  • See the macro code:
    !filepath = object file ('D:\MYDATA.txt')
    !readfilenames = !filepath.ReadFile()


    do !q val !readfilenames
       var !namefromfile coll all equi for $!q
       
       do !name values !namefromfile
           var !equiname append NAME OF $!name
       enddo


    enddo


    import 'MyDataAddin'
    handle any
    endhandle
    using namespace 'Aveva.Pdms.Presentation.MyDataAddin'
    !myData = object PMLMYDATA()
    -- Add Elements to MyData Collection
    !myData.addElements(!equiname)


    For E3D version, replace Aveva.Pdms.Presentation.MyDataAddin to: Aveva.Core.Presentation.MyDataAddin
  • [SIZE=3][SIZE=2]It's working, you're the man!
    [/SIZE]
    One last ask how could I create that object with custom name or rename it after creating because it gives me errors after trying
    (2,779)   Method
  • For custom collection name, see the macro code:
    import 'MyDataAddin'
    handle any
    endhandle
    using namespace 'Aveva.Pdms.Presentation.MyDataAddin'
    !myData = object PMLMYDATA()
    -- Create Data Collection Storage
    !myData.addCollection('MyDataCollection')
    -- Add Elements to MyData Collection
    !myData.addElementsToCollection(!equiname, 'MyDataCollection')


    Good that you've got the solution..!
  • if you don't care about the name of collections can also use > !!mydata.addElements([COLOR=#333333]!equiname[/COLOR]) to create a new collection series


    and access the latest collection as 'New Collection 1(or any series if more than 1)' use >  !!mydata.collections().last()

    - - - Updated - - -

    e.g:

    IMPORT 'MyDataAddin'handle any
    endhandle
    USING NAMESPACE 'Aveva.Core.Presentation.MyDataAddin'
    !!mydata = object PMLMYDATA()


    var !x mem
    !y = !x.split()
    !!mydata.addElements(!y)
    q var !!mydata.elementsInCollection(!!mydata.collections().last())