Question

i'm using PFM module of DOORS. I have to write to a file some information from a configuration in PFM.

I want all the paramaters with name, value and unit. The following is the code i tried, but couldn't get all the paramters

            DxlObject paramdxl = null

            DxlObject comp = CONF_getCompVersion(node)
            DxlObject progV = CONF_getUsingProgVersion (comp)
            param = CONF_getAllParams(comp, progV)

            for paramdxl in param do{
            string name1 = paramdxl->"name"
            string unit1 = paramdxl->"unit"
            string value1 = ""
            string value2 = ""
            string name2 = ""
            for value1 in paramdxl->"values" do{
                            }
            print "name: "name1 " value : " value1 " unit: " unit1 "\n"
        }

According to the PFM API, values of parameter is contained in Skip list. But value1 contains ''Standard layout'' instead of the value whereas the other values (name and unit) are correct.

Thank you for your help.

Was it helpful?

Solution

SOLVED :

Here is the code to export in file.csv list of criteria (with state) and parameters (with value and unit) from a configuration. This can be easily modify to export all elements in all configuration in a project PFM.

        //Path of CSV file
    Stream outcrit = write "C:\\YOURPATH\\crit.csv"
    Stream outparam = write "C:\\YOURPATH\\param.csv"
    string separator = ";"
    string endline = "\n"
    outcrit<< "famille"separator"nom"separator"etat"endline
    outparam<< "nom"separator"valeur"separator"unite"endline
    Skip param = create
    Skip param2 = create
    Skip crit = create
    Skip critSet = create
    Skip values1 = createString
    string c = ""
    string p = ""
    string message = ""
    string data = ""
    DxlObject dxlParam = null
    DxlObject dxl = null
    DxlObject dxlCritSet = null
    DxlObject dxlCrit = null
    int n = 1
    int type = CONF_getNodeType(node)
    if (type == CONF_PROG){ //Configuration selected

        infoBox "toto"
        DxlObject dxlConfig = null
        dxlConfig = node->"lastVersion" //Get Configuration set
        Skip activOpt = dxlConfig->"activOptions" //Get Criteria activated
        Skip packVer = dxlConfig->"compVersions" //Get list of package version
        DxlObject dxlPackVer = null
        for dxlPackVer in packVer do{   //Get Object package Version
        }
        DxlObject progV = CONF_getUsingProgVersion (dxlPackVer) 

        critSet = dxlPackVer->"variantsets" //Get list of criteria
        param = dxlPackVer->"params" //Get list of parameters

        print "Listes des criteres \n"
        for dxlCritSet in critSet do{
            string nameF = dxlCritSet->"name" //Name of criteria set
            print "famille :" nameF "\n"
            crit = dxlCritSet->"options" 
            for dxlCrit in crit do{
                string nameCrit = dxlCrit->"name" //Name of criteria
                bool stateCrit = false
                if (find(activOpt, dxlCrit)){
                    stateCrit = true //Update state of criteria
                }
                print "name :" nameCrit " state : "stateCrit"\n"
                outcrit<< nameF separator nameCrit separator stateCrit endline
            }

        }

        print "Listes des parametres \n"
        for dxlParam in param do{
            string nameParam = dxlParam->"name" //Parameter name
            string unitParam = dxlParam->"unit" //Parameter unit
            param2 = dxlParam->"values"
            string valueParam = ""
            find (param2, progV, valueParam)    //get parameter value
            print "Parametre " nameParam " : " valueParam " " unitParam "\n"
            outparam<< nameParam separator valueParam separator unitParam endline
        }
        close outcrit
        close outparam

nicodupe

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top