One thing that jumps out at me is that I see no primary key. Perhaps adding
<prim-key field="asset_itemid"/> and maybe if asset_itemid is not always unique <prim-key field="depid"/> -----Original Message----- From: Nattanicha Rittammanart [mailto:[EMAIL PROTECTED] Sent: Sunday, April 20, 2008 1:38 PM To: user@ofbiz.apache.org Subject: Query entity > Hi all, > I have a problem to ask you. > I have table like this: > > <entity package-name="org.ofbiz.ams.ams" > entity-name="DepreciationTrans" title="Keeps depreication record from > depreciation table which created in each period"> > <field type="id-ne" name="asset_itemid"></field> > <field type="id-ne" name="depid"/> > <field type="id" name="account_no"/> > <field type="currency-amount" name="value_before_cal"/> > </entity> > > I want to show it by using form, I do like this: > > <form name="ShowDepreTables" type="list" list-name="depre_to_dates" > paginate-target="ShowDepreTable"> > <actions> > <entity-condition entity-name="DepreciationTrans"><order-by > field-name="calculate_date"/></entity-condition> > </actions> > <field name="asset_itemid" title="asset itemid"><display/></field> > <field name="depid" title="department id"><display/></field> > <field name="account_no" title="account number"><display/></field> > <field name="value_before_cal" title="before > price"><display/></field> > </form> > > But asset_itemid is a field which link from another table. If I show > table as above, it will show asset_itemid. What I want is, I need it > to show asset_item_name. So, I do like this: > > ...... > <field name="asset_itemid" title="asset item name"> > <display-entity entity-name="AssetItems" > description="${asset_item_desc}" > key-field-name="asset_itemid"></display-entity> > </field> > ...... > > But it caused error like this > > org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen > [component://ams/widget/common/CommonScreens.xml#GlobalDecorator]: > java.lang.IllegalArgumentException: Error getting value from the > database for display of field [asset_itemid] on form > [ShowDepreTables]: org.ofbiz.entity.GenericModelException: > [GenericDelegator.findOne] Passed primary key is not a valid primary > key: > [GenericEntity:AssetItems][asset_itemid,08000200010002(java.lang.String)] > (Error getting value from the database for display of field > [asset_itemid] on form [ShowDepreTables]: > org.ofbiz.entity.GenericModelException: [GenericDelegator.findOne] > Passed primary key is not a valid primary key: > [GenericEntity:AssetItems][asset_itemid,08000200010002(java.lang.String)]) > > > How can I do to link asset_item_name from another table to show in > table which has asset_itemid?? > > Thank in advances, > Nattanicha > No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.0/1381 - Release Date: 4/16/2008 9:34 AM No virus found in this outgoing message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.0/1381 - Release Date: 4/16/2008 9:34 AM