PDA

View Full Version : Precision of Float-Attributes


wilfried_loewe
06-14-2007, 04:41 AM
Hi,
does anyone know, how set the precision of Float-Attributes ??? I use the following XML-Extend:

<Attribute>
AKOST2_BEARBINTERN
<DisplayName>Kosten Eigenfertigung</DisplayName>
<Visible>true</Visible>
<IncludeIn2DBOM>true</IncludeIn2DBOM>
<IncludeInLayoutManager>true</IncludeInLayoutManager>
<Searchable>false</Searchable>
<DisplayFormat>%.2f</DisplayFormat>
<Index>12.0</Index>
</Attribute>

The Tag <DisplayFormat> does not work in Attribute Section - see Dump - Why ??? Should I used a Special EditorClass ??? The Formatter of the Class does only check for legal numbers/characters. The Formatter should only insert formatted Values in the Table Column !!!

alexniccoli
06-20-2007, 11:45 PM
I think that best way is use Data Dictionary, creating a FLOAT Data dictionary specifing number of decimals and associating this dd to your attribute.
Alessandro

wilfried_loewe
06-21-2007, 01:21 AM
Hi Alessandro,

thanks for your reply and your tip use a FLOAT Data dictionary. In the customize.chm - section <DisplayFormat> - see beginning of Description:

*********************************************************
Description
This tag defines how to display an attribute value within a specific class. The format applies to attributes displayed in tables or "Send to" items, but not to editors or DB Properties.
.
.
.
*********************************************************
So this Tag is not used in Editor/Attribut Section !!!!

Let me give a WARNING to use a FLOAT Data dictionary (Classic Style - see DT_DL_FLOAT_3):

Make_dd '"DT_DL_FLOAT_1","base",1,0,"FLOAT",1,,,1,,,,,0'
Make_dd '"DT_DL_FLOAT_2","base",1,0,"FLOAT",2,,,1,,,,,0'
Make_dd '"DT_DL_FLOAT_3","base",1,0,"FLOAT",3,,,1,,,,,0'

Using this, you will become big problems, when this Attrubute has crytical Values - opening the Attribut Editor:

-----------------------------------------------------------------------
java.lang.Throwable: Wert dieses Attributs ist länger als erlaubte Zeichenanzahl
at com.osm.editor.FixedSizePlainDocument.insertString(Unknown Source)
at javax.swing.text.AbstractDocument.replace(Unknown Source)
at javax.swing.text.JTextComponent.setText(Unknown Source)
at com.osm.ui.utils.WMJTextField.setText(Unknown Source)
at com.osm.editor.WMAttEditorTextField.setAttributeVal(Unknown Source)
at com.osm.property.AttributePanel.setEditorValues(Unknown Source)
at com.osm.property.AttributePanel.setDBObject(Unknown Source)
at com.osm.property.DefaultTabbedEditor.setDBObject(Unknown Source)
at com.osm.biz.WMDBObject.getWMEditor(Unknown Source)
at com.osm.biz.WMElement.getWMEditor(Unknown Source)
at com.osm.biz.WMDBObject.getDisplayComponent(Unknown Source)
at com.osm.datamgmt.ui.WindowManager$3.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
-----------------------------------------------------------------------

You become an "Attribut To Long Exception" (three times of every Attribut) - without any Information, which Attribute is the Problem !!! When you now open the Editor in Edit Mode - Save - !!!! WARNING !!!!! - the Value of this Attribute is cleared (empty !!!!)
To find out, what Attribute is the Problem, I use an EventHandler - here the Printout:

Audittest-Event at:Sat Jun 16 16:32:48 CEST 2007
Opened file: 1 recordSets
Object Name: 591-18.0-08S1: [1] Arbeit
Attribute Change - ATTRIBUTE_CHANGE
*** Index i: 0, Index j: 0
Record Event Type : Attributänderung
Record Event Num. : 6
AttributeName : IF_EINSGEW
Creator : medmgr
Description : 'Einsatzgewicht' geändert von '0.045000000000000005' zu ' '.
ItemId : BT1XU7NDHXU076
OldValue : 0.045000000000000005
NewValue :
RelatedItemId :
RecordDate : Sat Jun 16 16:32:39 CEST 2007


The Attribute IF_EINSGEW is the Problem - changed to emty value ''

So we had to delete the FLOAT Data dictionary and accept the bad formatting/output (see Einsatzgewicht.jpg) of Attribute Editor, until CC solved this Problem ...

alexniccoli
06-21-2007, 01:53 AM
I try with release 14 but i have no problem like you.
You can also try to create attribute DECIMAL specifing number of decimals
without use data dictionary.

Alessandro

wilfried_loewe
06-21-2007, 11:25 AM
Hi Alessandro,

I use Release 15.00A. I just test to use Datatype DECIMAL with specifing number of decimals without Data dictionary. There is also a bug in ModelManager, because you can only type in number of decimals. Number of decimals is interpreted as length of value - not of number of decimals.