Get text from Layout DXL populated column

Hi all,

 

I'm currently writing a script that requires me to use the text value assigned to each object in a column. This column is populated by some layout dxl (the layout dxl uses displayRich() ).

I'd like to be able to get the respective text value for each object, something like:

 

Object obj

for obj in current Module do
{
    print obj."Layout Column"
}

Any help would be greatly appreciated, thanks in advance.

 

Jake


jsjlewis - Thu May 18 07:05:40 EDT 2017

Re: Get text from Layout DXL populated column
PekkaMakinen - Fri May 19 04:38:09 EDT 2017

See the help for  function text in DXL Reference: string text(Column c,  Object o)

Re: Get text from Layout DXL populated column
jsjlewis - Mon May 22 04:51:59 EDT 2017

PekkaMakinen - Fri May 19 04:38:09 EDT 2017

See the help for  function text in DXL Reference: string text(Column c,  Object o)

Unfortunately this returns a blank value, I assume it's because the column is populated by layout DXL. I was able to get the text value for the columns either side, so I don't think I'm using the text() method incorrectly

Re: Get text from Layout DXL populated column
PekkaMakinen - Mon May 22 08:11:42 EDT 2017

jsjlewis - Mon May 22 04:51:59 EDT 2017

Unfortunately this returns a blank value, I assume it's because the column is populated by layout DXL. I was able to get the text value for the columns either side, so I don't think I'm using the text() method incorrectly

Works for me in DOORS 9.6.0.3. If you run this code by selecting an object with text in Layout DXL (modified from example) do you really get empty values for Layout DXL columns in view?

Object o = current
Column c
    for c in current Module do {
        if (main c) {
            print o."Object Heading" "\n\n"
            print o."Object Text" "\n\n"
       } else {
            print text(c, o) "\n"
       }
    }

 

Re: Get text from Layout DXL populated column
jsjlewis - Mon May 22 09:30:23 EDT 2017

PekkaMakinen - Mon May 22 08:11:42 EDT 2017

Works for me in DOORS 9.6.0.3. If you run this code by selecting an object with text in Layout DXL (modified from example) do you really get empty values for Layout DXL columns in view?

Object o = current
Column c
    for c in current Module do {
        if (main c) {
            print o."Object Heading" "\n\n"
            print o."Object Text" "\n\n"
       } else {
            print text(c, o) "\n"
       }
    }

 

Interestingly I don't (which is good?). I assume it's because I wasn't looping through each column, rather I was using 

Object obj = current

Column col = column(9)
                                                
print text(traceColumn, obj)

 

Which does not seem to work. I'll use the loop and somehow filter to only get the value from the column I want. Thanks!

Re: Get text from Layout DXL populated column
jsjlewis - Mon May 22 10:11:45 EDT 2017

Just to expand on what I've already said, the following code doesn't seem to work (whilst your example does)

Module currentModule = read("module_path", false, false)
Object obj
Column col

for obj in currentModule do
{
        string objType = obj."ObjType"
        if (objType == "Requirement")
        {
        for col in currentModule do
        {
                print text(col, obj) "\n"
        }
        }
}

Which is really strange...

Re: Get text from Layout DXL populated column
PekkaMakinen - Tue May 23 00:24:46 EDT 2017

jsjlewis - Mon May 22 09:30:23 EDT 2017

Interestingly I don't (which is good?). I assume it's because I wasn't looping through each column, rather I was using 

Object obj = current

Column col = column(9)
                                                
print text(traceColumn, obj)

 

Which does not seem to work. I'll use the loop and somehow filter to only get the value from the column I want. Thanks!

Well. you are stating that you are using a variable "col" Column col = column(9), but then you are getting the text of column traceColumn print text(traceColumn, obj). Should be "print text(col, obj)".

Re: Get text from Layout DXL populated column
PekkaMakinen - Tue May 23 00:36:49 EDT 2017

jsjlewis - Mon May 22 10:11:45 EDT 2017

Just to expand on what I've already said, the following code doesn't seem to work (whilst your example does)

Module currentModule = read("module_path", false, false)
Object obj
Column col

for obj in currentModule do
{
        string objType = obj."ObjType"
        if (objType == "Requirement")
        {
        for col in currentModule do
        {
                print text(col, obj) "\n"
        }
        }
}

Which is really strange...

Your read command opens the module default view in invisible mode. It should print out the text also for Layout DXL columns, but does the default view have layout columns?