![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Detection of Edit DXL Window warnings Topic Summary: Created On: 24-Jul-2006 19:16 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Is there any way, in a script, of knowing whether a warning has been placed in the Edit DXL window? I am trying to identify objects which have had a text attribute truncated because the string being placed in the attribute exceeds the maximum length for a non-object text string attribute. This condition generates a warning, but I've not been able to figure out a non-clunky way of detecting this in the script. One such clunky way is to read the attribute back and compare it to the original string, but I'm hoping not to have to do that.
Searching through the DXL manual hasn't turned up anything that seems useful, but I'd be happy to be corrected on that! Thanks. |
|
![]() |
|
![]() |
|
Have you looked at noerror() and lasterror()? Not sure if they'll catch plain warnings that don't halt the script, but it'll give you a place to start. Look in the manual under "Error Handling."
Chris |
|
![]() |
|
![]() |
|
Thanks for the response, Chris.
I've tried dxlWarningLineNumber, which did nothing since the warnings aren't in popups (one could still hope ...). lastError and noError didn't detect warnings, either. Kent |
|
![]() |
|
![]() |
|
I think you mean errors generated when placing big text into a 'string' attribute. I notice in v8.1 when I paste a very long string into a string attribute, I get a DXL dialog error, not a DXL error in the DXL window.
If the operation is a manual one I don't see any way of having some backgroup DXL monitoring for errors, and trapping it and dealing with it. However, you could realistically write a pre-save-attribute trigger that approves changes to non-string attributes, but for string attributes gets the proposed string, compares it to the maximum allowed string length (defined constant 'maximumAttributeLength'), and rejects the change and displays a window. That is, it anticipates the error and prevents it. If you are using DXL to set the attribute, then you can do something like the attached. Its important to keep the noError() paired up closely with the lastError() command; otherwise you will get hopelessly lost. noError() stays in effect until it reaches lastError() which resets noError(). noError() ends with the script, but I'm not sure if it stays in effect if a dialog of the script is still running. - Louie |
|
![]() |
|
![]() |
|
You could prevent the warnings in the first place by comparing the length of the string to maximumAttributeLength and if it is longer then only copy the first maxumumAttributeLength's worth of characters.
string someText = "whatever" if (length(someText) > maximumAttributeLength) { o."My Attribute" = someText[0:maximumAttributeLength-1] print "object " idenfitier(o) " truncated\n" } else { // straight copy } ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
Replying to Louie:
That looks very much like what I've tried. The problem is that warnings are generated, not errors (dxl-w-stuff). The noError and lastError are impervious to warnings. Or am I missing something? Thanks for looking at this. Kent |
|
![]() |
|
![]() |
|
Replying to Tony: Some information that wasn't in the thread is that the original string is coming from the Object Text attribute (which of course has no maximum length). I've tended not to use string lengths in scripts because we use rich text in order to, e.g., avoid losing insertion of symbols such as degree signs, and at first it was confusing to me to juggle between rtf and plain text. |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Detection of Edit DXL Window warnings
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.