Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 24-Jul-2006 19:16
User is offline View Users Profile Print this message


Kent Power

Posts: 18
Joined: 28-Apr-2005

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.
Report this to a Moderator Report this to a Moderator
 24-Jul-2006 19:52
User is offline View Users Profile Print this message


Chris Jones

Posts: 177
Joined: 1-Jul-2005

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
Report this to a Moderator Report this to a Moderator
 25-Jul-2006 19:17
User is offline View Users Profile Print this message


Kent Power

Posts: 18
Joined: 28-Apr-2005

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
Report this to a Moderator Report this to a Moderator
 26-Jul-2006 00:38
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 27-Jul-2006 09:10
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 31-Jul-2006 17:03
User is offline View Users Profile Print this message


Kent Power

Posts: 18
Joined: 28-Apr-2005

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
Report this to a Moderator Report this to a Moderator
 31-Jul-2006 17:31
User is offline View Users Profile Print this message


Kent Power

Posts: 18
Joined: 28-Apr-2005

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.

Your suggest works, and is better than reading back the string so it can be compared with the original.  Probably the safest way to use it though is with richText to acquire and write the strings to and from attributes.

Thanks for looking at this.

Kent

Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.