greghume's Profile
Agile Angel
1016
Points

Questions
0

Answers
3

  • Agile Angel Asked on February 4, 2019 in Agile PLM (v9).

    i don’t have any answers, Kev seems to’ve covered almost everything.  i only wonder, in this case of duplicate list entries, if the Apiname on the list entries is different than the values.

    • 1341 views
    • 4 answers
    • 0 votes
  • You asked a simple question that requires a fairly complex answer, because one must account for static and dynamic lists, as well as flat and cascading lists. 
    The code below is a functioning groovy example of collecting list values for a given subclass and cell.
    It works. i’m sure it can be improved, (i’m interested in any improvements to it).  it runs on Agile 9.3.6

    // given:
    // sdk – the agile session
    // subclassName – the agile subclass name
    // apiName – a given cell apiname
    // return:
    // the list of values, if any.

    subclass = sdk.getAgileClass(subclassName)
    attribute = subclass.getAttribute(apiName)
    listName = attribute?.getProperty(‘List’)?.getValue()
    list = sdk.getAdmin().getListLibrary().getAdminList(listName as String)

    println “subclass|$subclass|attribute|$attribute|list|$list”

    items = []

    // STATIC LISTS
    if( list.isEnumeratable() ) {

            // STATIC NON-CASCADED LISTS
            if( !list.isCascaded()) {
                    items = list.getAdminList()?.getItems().findAll{it.isObsolete() == false} as String[]
            }
            // STATIC CASCADED LISTS
            else {
                    items = []
                    adminList = list.getAdminList()
                    adminList.getItems().findAll{ it.isObsolete() == false}.each {
                            if (it.parentItemID == 0) {
                                    it.children.each { items.add( “${it.name}|$it” )}
                            }
                    }
            }

    } else { // DYNAMIC LISTS — Use the list’s query to get its items.

            adminList = list.getAdminList()
            criteria = sdk.getAdmin().getNode( adminList.getCriteria().getProperties()[‘ID’] )
            QCLASS = (criteria) ? criteria.getCriteriaClass() : list.getListAgileClass()
            QQUERY = (criteria) ? criteria.getCriteria() : “”

            items = sdk.query( QCLASS, QQUERY ).collect { row ->

                    value = row.getCells()[0]
                    // you could handle special cases here, for example: 
                    if( QCLASS.toString() == ‘Users’) {
                            fname = row.getValue(‘firstName’)
                            lname = row.getValue(‘lastName’)
                            uid = row.getValue(‘userID’)
                            value = “$fname $lname ($uid)”
                    }
                    return value
            }
    // done.
    }
    println “items:(if any)”
    items.each {println it}

    • 2124 views
    • 3 answers
    • 0 votes
  • Agile Angel Asked on December 1, 2018 in Other APIs.

    Oracle provides a high-speed dataloader to select third-party support organizations, without support.
    It’s been years since i used it, but we were able to load thousands of records in minutes. 
    The Oracle Agile Support manager owns it & might provide the loader on request.

    • 2752 views
    • 4 answers
    • 0 votes