Can't assign Object Text to Object Text?

Well I know this is going to be something silly, but:

Why can't I directly assign Object Text from one object to another, like this:

Object Lorem=object(1)
Object Ipsum=object(2)
Ipsum."Object Text"=Lorem."Object Text" //incorrect arguments for (=)

 


But this works:

 

 

Object Lorem=object(1)
Object Ipsum=object(2)
string LoremObjTxt=Lorem."Object Text"
Ipsum."Object Text"=LoremObjTxt



Maybe some kind of casting etc. is required to make the first form work?

Regards,
strathglass



 


strathglass - Fri Apr 08 21:17:41 EDT 2011

Re: Can't assign Object Text to Object Text?
strathglass - Sat Apr 09 10:28:45 EDT 2011

To answer my own question, yes ... cast:

Ipsum."Object Text"=Lorem."Object Text" ""

 


I was sure I had tried that! :(

-strathglass

 

Re: Can't assign Object Text to Object Text?
strathglass - Sat Apr 09 10:28:54 EDT 2011

To answer my own question, yes ... cast:

Ipsum."Object Text"=Lorem."Object Text" ""

 


I was sure I had tried that! :(

-strathglass

 

Re: Can't assign Object Text to Object Text?
Mathias Mamsch - Sun Apr 10 12:36:45 EDT 2011

strathglass - Sat Apr 09 10:28:54 EDT 2011

To answer my own question, yes ... cast:

Ipsum."Object Text"=Lorem."Object Text" ""

 


I was sure I had tried that! :(

-strathglass

 

The perms list will give you the reason why one is not working and the other one is. If you wish to dive into that, just say so ;-) Anyway you should check if you want to have richText (i.e. formatted text parts) copied over to the other object. In this case, you can do:
 

Ipsum."Object Text" = richText richTextWithOle Lorem."Object Text"

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Can't assign Object Text to Object Text?
llandale - Mon Apr 11 13:40:59 EDT 2011

strathglass - Sat Apr 09 10:28:45 EDT 2011

To answer my own question, yes ... cast:

Ipsum."Object Text"=Lorem."Object Text" ""

 


I was sure I had tried that! :(

-strathglass

 

Far better to use this secret:
string set(Attr__ To,Attr__ From) // To,From RichTextWith OLE OK

e.g.
set(oTo."Object Text", oFrom."Object Text")

Don't know what the returned string is; seems to be null when its OK and garbage when there was an error. Seems to me you need to surround with noError() and lastError().

noError()
set(oTo."Object Text", oFrom."Object Text")
string ErrMess = lastError()
if (!null ErrMess)...

I see that the AttrRef can indeed be a link or module attribute, but doubt that's useful.

  • Louie

Re: Can't assign Object Text to Object Text?
strathglass - Tue Apr 12 21:26:41 EDT 2011

llandale - Mon Apr 11 13:40:59 EDT 2011
Far better to use this secret:
string set(Attr__ To,Attr__ From) // To,From RichTextWith OLE OK

e.g.
set(oTo."Object Text", oFrom."Object Text")

Don't know what the returned string is; seems to be null when its OK and garbage when there was an error. Seems to me you need to surround with noError() and lastError().

noError()
set(oTo."Object Text", oFrom."Object Text")
string ErrMess = lastError()
if (!null ErrMess)...

I see that the AttrRef can indeed be a link or module attribute, but doubt that's useful.

  • Louie

Thanks Mathias and Louie.
I don't know if I want to dive in any further into those perms you mentioned. But I have to do something!

My real script is STILL giving problems: I have added the "" to cast the source object to string.
But the result is I have simply substituted my original errors (-E- DXL: <Line:1243> incorrect arguments for (.); -E- DXL: <Line:1244> incorrect arguments for (=))
for new ones (-E- DXL: <Line:1243> incorrect arguments for (.); -E- DXL: <Line:1243> incorrectly concatenated tokens).

What is the source of the incorrectly concatenated token errors?

I also have one other unexplained error in my for() loop.

All of the errors (shown at the bottom) are in the following section of code:

for lookupTableCellObject in row(newLookupTableRow) do   // What is wrong with this line?? Here is the error: -E- DXL: <Line:1226> incorrect arguments for (do)
{   //update each new cell in this new row as required (there should be no deleted cells in this new row):
    colCount++
    if (colCount>=colCntLookup)
    {    
        errMsg="Unexpected cell count (too many) in newly added internal lookup table: expected count was " colCntLookup ""
        dataLogger(logERR,errMsg)
        break //skip (rest of) this invalid row
    }        
    if (colCount==keyColPosLookup)
    {   //Copy over output table's key cell value to lookup table key cell:
        //first, however, we must remove any leading and trailing whitespace:
        otxt=keyCell."Object Text"
        if (reWhitespaceSurround otxt)
        {    
            otxt=otxt[match 1] //this will strip off the leading/trailing white space
        }        
        lookupTableCellObject."Object Text"=otxt "" //***OK, this is still not working, here are the two errors:-E- DXL: <Line:1243> incorrect arguments for (.); -E- DXL: <Line:1243> incorrectly concatenated tokens
    }        
    else if (colCount==sourceColPosLookup)
    {   //set the source information:
        //first, we are required to remove any leading or trailing white space before copying over this information to the lookup table:
        if (reWhitespaceSurround currentSource) 
        {    
            currentSource=currentSource[match 1] //this will strip off the leading/trailing white space
        }        
        lookupTableCellObject."Object Text"=currenSource "" //***OK, this too isn't working: but this is just a typo (have to go change currenSource to currentSource), when fixed I expect it to get the same error as the other cases here!
    }        
    else if (lookupTableStatic[colCount]!="")
    {   //set the static values per the lookup table definition info:
        lookupTableCellObject."Object Text"=lookupTableStatic[colCount] "" //***OK, another error here: like the first one: -E- DXL: <Line:1256> incorrect arguments for (.); -E- DXL: <Line:1256> incorrectly concatenated tokens
    }        
    else if (lookupTableMappedFromOutput[colCount]!="")
    {   //finally, copy over any mapped values:
        o=getDataRowCellByColHdg(outputTableRowObject,lookupTableMappedFromOutput[colCount],outputTableColumns)
        if (null o)
        {    
            errMsg="Couldn't find mapped-from object in output table when building internal lookup table: couldn't find for column mapped from output table column '"
            errMsg=errMsg lookupTableMappedFromOutput[colCount] "'" 
            dataLogger(logERR,errMsg)
            continue //maybe only this column bad, so keep trying with rest of columns for this new row
        }        
        lookupTableCellObject."Object Text"=o."Object Text" "" //**OK, yet another one: -E- DXL: <Line:1268> incorrect arguments for (.); -E- DXL: <Line:1268> incorrectly concatenated tokens
    }        
}

 


Here are the errors:

 

 

-E- DXL: <Line:1243> incorrect arguments for (.)
-E- DXL: <Line:1243> incorrectly concatenated tokens
-E- DXL: <Line:1252> incorrect arguments for (.)
-E- DXL: <Line:1252> incorrectly concatenated tokens
-E- DXL: <Line:1252> undeclared variable (currenSource)  //(this one is my typo, oops)
-E- DXL: <Line:1256> incorrect arguments for (.)
-E- DXL: <Line:1256> incorrectly concatenated tokens
-E- DXL: <Line:1268> incorrect arguments for (.)
-E- DXL: <Line:1268> incorrectly concatenated tokens
-E- DXL: <Line:1226> incorrect arguments for (do)
 too many messages -- suspending error reporting-I- DXL: all done with



Any pointers on what to try to debug this would be much appreciated!

Thanks!



 

Re: Can't assign Object Text to Object Text?
llandale - Wed Apr 13 15:01:24 EDT 2011

strathglass - Tue Apr 12 21:26:41 EDT 2011

Thanks Mathias and Louie.
I don't know if I want to dive in any further into those perms you mentioned. But I have to do something!

My real script is STILL giving problems: I have added the "" to cast the source object to string.
But the result is I have simply substituted my original errors (-E- DXL: <Line:1243> incorrect arguments for (.); -E- DXL: <Line:1244> incorrect arguments for (=))
for new ones (-E- DXL: <Line:1243> incorrect arguments for (.); -E- DXL: <Line:1243> incorrectly concatenated tokens).

What is the source of the incorrectly concatenated token errors?

I also have one other unexplained error in my for() loop.

All of the errors (shown at the bottom) are in the following section of code:

for lookupTableCellObject in row(newLookupTableRow) do   // What is wrong with this line?? Here is the error: -E- DXL: <Line:1226> incorrect arguments for (do)
{   //update each new cell in this new row as required (there should be no deleted cells in this new row):
    colCount++
    if (colCount>=colCntLookup)
    {    
        errMsg="Unexpected cell count (too many) in newly added internal lookup table: expected count was " colCntLookup ""
        dataLogger(logERR,errMsg)
        break //skip (rest of) this invalid row
    }        
    if (colCount==keyColPosLookup)
    {   //Copy over output table's key cell value to lookup table key cell:
        //first, however, we must remove any leading and trailing whitespace:
        otxt=keyCell."Object Text"
        if (reWhitespaceSurround otxt)
        {    
            otxt=otxt[match 1] //this will strip off the leading/trailing white space
        }        
        lookupTableCellObject."Object Text"=otxt "" //***OK, this is still not working, here are the two errors:-E- DXL: <Line:1243> incorrect arguments for (.); -E- DXL: <Line:1243> incorrectly concatenated tokens
    }        
    else if (colCount==sourceColPosLookup)
    {   //set the source information:
        //first, we are required to remove any leading or trailing white space before copying over this information to the lookup table:
        if (reWhitespaceSurround currentSource) 
        {    
            currentSource=currentSource[match 1] //this will strip off the leading/trailing white space
        }        
        lookupTableCellObject."Object Text"=currenSource "" //***OK, this too isn't working: but this is just a typo (have to go change currenSource to currentSource), when fixed I expect it to get the same error as the other cases here!
    }        
    else if (lookupTableStatic[colCount]!="")
    {   //set the static values per the lookup table definition info:
        lookupTableCellObject."Object Text"=lookupTableStatic[colCount] "" //***OK, another error here: like the first one: -E- DXL: <Line:1256> incorrect arguments for (.); -E- DXL: <Line:1256> incorrectly concatenated tokens
    }        
    else if (lookupTableMappedFromOutput[colCount]!="")
    {   //finally, copy over any mapped values:
        o=getDataRowCellByColHdg(outputTableRowObject,lookupTableMappedFromOutput[colCount],outputTableColumns)
        if (null o)
        {    
            errMsg="Couldn't find mapped-from object in output table when building internal lookup table: couldn't find for column mapped from output table column '"
            errMsg=errMsg lookupTableMappedFromOutput[colCount] "'" 
            dataLogger(logERR,errMsg)
            continue //maybe only this column bad, so keep trying with rest of columns for this new row
        }        
        lookupTableCellObject."Object Text"=o."Object Text" "" //**OK, yet another one: -E- DXL: <Line:1268> incorrect arguments for (.); -E- DXL: <Line:1268> incorrectly concatenated tokens
    }        
}

 


Here are the errors:

 

 

-E- DXL: <Line:1243> incorrect arguments for (.)
-E- DXL: <Line:1243> incorrectly concatenated tokens
-E- DXL: <Line:1252> incorrect arguments for (.)
-E- DXL: <Line:1252> incorrectly concatenated tokens
-E- DXL: <Line:1252> undeclared variable (currenSource)  //(this one is my typo, oops)
-E- DXL: <Line:1256> incorrect arguments for (.)
-E- DXL: <Line:1256> incorrectly concatenated tokens
-E- DXL: <Line:1268> incorrect arguments for (.)
-E- DXL: <Line:1268> incorrectly concatenated tokens
-E- DXL: <Line:1226> incorrect arguments for (do)
 too many messages -- suspending error reporting-I- DXL: all done with



Any pointers on what to try to debug this would be much appreciated!

Thanks!



 

This sure would be eaiser if you told us how you have defined your variables. But it seems that variable "lookupTableCellObject" is supposed to be an "Object" but it isn't; which would explain the errors at lines 1226, 1243, 1256, and 1268.

Perhaps you are not bothering to declare it and it is cast incorrectly in the 1st line; although I have no idea what type it would cast it to.

Surely turn Auto-Declare OFF.

  • Louie

Re: Can't assign Object Text to Object Text?
llandale - Wed Apr 13 15:07:52 EDT 2011

llandale - Wed Apr 13 15:01:24 EDT 2011
This sure would be eaiser if you told us how you have defined your variables. But it seems that variable "lookupTableCellObject" is supposed to be an "Object" but it isn't; which would explain the errors at lines 1226, 1243, 1256, and 1268.

Perhaps you are not bothering to declare it and it is cast incorrectly in the 1st line; although I have no idea what type it would cast it to.

Surely turn Auto-Declare OFF.

  • Louie

Your first line may also have a bug. Variable "newLookupTableRow" suggests that its of type "Object" and is in fact the row object itself. I suspect that "row(newLookupTableRow)" part will therefore not work, since I doubt that row command will return the row handle when sent a row handle. I suspect you will need to "row()", leaving

for lookupTableCellObject in newLookupTableRow

..err..
Object lookupTableCellObject
for lookupTableCellObject in newLookupTableRow

  • Louie

Re: Can't assign Object Text to Object Text?
strathglass - Sun Apr 17 09:45:48 EDT 2011

llandale - Wed Apr 13 15:07:52 EDT 2011
Your first line may also have a bug. Variable "newLookupTableRow" suggests that its of type "Object" and is in fact the row object itself. I suspect that "row(newLookupTableRow)" part will therefore not work, since I doubt that row command will return the row handle when sent a row handle. I suspect you will need to "row()", leaving

for lookupTableCellObject in newLookupTableRow

..err..
Object lookupTableCellObject
for lookupTableCellObject in newLookupTableRow

  • Louie

Thanks for the input Louie. I will check to see if AutoDeclare is on or not.
However I always declare every variable I use.
(Couldn't find any AutoDeclare.dxl or AutoDeclareSet.dxl script here or with google, but from another thread it sounds like you can disable auto-declare by adding line "XFLAGS_ &=~AutoDeclare_" to file<C:\Program Files\Telelogic\DOORS_?.?\lib\dxl\startup.dxl>)

In this case, the sample code I provided is from a function, and at the top of the function I do indeed declare the variable lookupTableCellObject:

Object lookupTableCellObject


The next line after the declaration where this variable is used is the start of the for loop in the sample code I provided.
So I am not sure what the error could be.

As for the row() comment, I will explain how that works:

 

//get a data cell within table:
Object appendFromObject //not shown here, but this is initially set to be an object within a row of a table; i.e. a regular data cell in a table (not the invisible row object)
 
//now add a new row to my table, located after the row containing the above data cell:
Object newLookupTableRow=appendRow(appendFromObject) //from my testing, appendRow() returns the last data cell added in the newly created/appended row (not the invisible row object)
 
//finally, get invisible row object for the newly added row:
newLookupTableRow=getRow(newLookupTableRow) //this returns the invisible row object for the row containing the specified data cell


After this, my for() loop from my prior post starts.
So it all looks OK to me, since according to the DXL manual, the "for cell in row" loop takes the invisible row header object, and the DXL manual example actually uses the form "row(rowHeaderObject)":

 

 

//from the DXL manual (with comments added):
Object rowHead
for rowHead in table current Object do 
{
    Object cell
    for cell in row rowHead do //rowHead is already an invisible table row header object, and they are calling row() on it, so it must be OK to do this
    {
        print identifier cell "\n"
    }
}



In fact, I think I had this whole block working when I extracted out this function from the rest of the code. I think I need to try that again to confirm, which tells me it would be something somewhere else causing this. Strange.

I appreciate the input Louie. If anything above looks odd, please let me know. Otherwise I will do a bunch of testing to isolate the issue, and promise to report back what I find. :)

Regards,
strathglass



 

Re: Can't assign Object Text to Object Text?
llandale - Sun Apr 17 13:50:06 EDT 2011

strathglass - Sun Apr 17 09:45:48 EDT 2011

Thanks for the input Louie. I will check to see if AutoDeclare is on or not.
However I always declare every variable I use.
(Couldn't find any AutoDeclare.dxl or AutoDeclareSet.dxl script here or with google, but from another thread it sounds like you can disable auto-declare by adding line "XFLAGS_ &=~AutoDeclare_" to file<C:\Program Files\Telelogic\DOORS_?.?\lib\dxl\startup.dxl>)

In this case, the sample code I provided is from a function, and at the top of the function I do indeed declare the variable lookupTableCellObject:

Object lookupTableCellObject


The next line after the declaration where this variable is used is the start of the for loop in the sample code I provided.
So I am not sure what the error could be.

As for the row() comment, I will explain how that works:

 

//get a data cell within table:
Object appendFromObject //not shown here, but this is initially set to be an object within a row of a table; i.e. a regular data cell in a table (not the invisible row object)
 
//now add a new row to my table, located after the row containing the above data cell:
Object newLookupTableRow=appendRow(appendFromObject) //from my testing, appendRow() returns the last data cell added in the newly created/appended row (not the invisible row object)
 
//finally, get invisible row object for the newly added row:
newLookupTableRow=getRow(newLookupTableRow) //this returns the invisible row object for the row containing the specified data cell


After this, my for() loop from my prior post starts.
So it all looks OK to me, since according to the DXL manual, the "for cell in row" loop takes the invisible row header object, and the DXL manual example actually uses the form "row(rowHeaderObject)":

 

 

//from the DXL manual (with comments added):
Object rowHead
for rowHead in table current Object do 
{
    Object cell
    for cell in row rowHead do //rowHead is already an invisible table row header object, and they are calling row() on it, so it must be OK to do this
    {
        print identifier cell "\n"
    }
}



In fact, I think I had this whole block working when I extracted out this function from the rest of the code. I think I need to try that again to confirm, which tells me it would be something somewhere else causing this. Strange.

I appreciate the input Louie. If anything above looks odd, please let me know. Otherwise I will do a bunch of testing to isolate the issue, and promise to report back what I find. :)

Regards,
strathglass



 

At home, got no DOORS here.

I strongly suggest you put that in your startup.dxl so you can develop DXL with autodeclare off. But you still need a mechanism for turning it on (without re-starting DOORS after suppressing that line), so you can run Layouts and Attr-DXL deployed by folks taking full advantage of the autodeclare <<Disallowed Content Detected>>. Maybe I'll post that script again when I get back to work.

It won't be the first time I was wrong after being adamant I was right, but I have no idea how the following can fail complaining about parameters for "." unless lookupTableCellObject is not a variable of type Object (or some other data types).

lookupTableCellObject."Object Text"=lookupTableStaticcolCount ""

Since your original loop also failed ... in fact all the lines using that variable failed ... I'm sure I'm right about this. Perhaps you should post the script, or at a minimum the entire function along with whatever global variables it uses.

If variable "oRow" is the invisible row object, then I wonder what "row(oRow)" returns. You should verify it returns the same object but I'm suspecting it returns null.f

Your sample loop in this post looks good, but it would look a lot better if you also printed "\t" number(cell)", then you can see the hierarchy pretty well. And because I'm ADHD I would do this so I could see my nice clean orderly table:

void  PrintObj(Object obj, string Label)
{  print Label "\t" identifier(obj) "\t" number(obj) "\n"
}
Object rowHead
Object oTable = table(current Object)
if (null oTable) halt
PrintObj(oTable, "Table")
for rowHead in oTable do 
{   PrintObj(RowHead, " Row")
    Object cell
    for cell in rowHead do 
    {
        PrintObj(cell, "  Cell")
    }
}

 

  • Louie