I'm tryng to open list view filtered by the value of selected row in a preceding list view.
This forms are based on different tables; key fields have also different names.
In details:
- the first view presents a list of customers (table=CUSTOMER, key=CUSTOMER_ID) with associated radio
- the second must presents the orders of a selected customer (table=ORDER, key=ORDER_ID, FK_to_customer_table=ORDER_CUSTOMER_ID)
I searched through dbTags docs and found some tags and attributes that seems can be helpful on that:
- associatedRadio, linkURL, gotoButton tags
- pos, keyTokey, keyTokeyTo ... ecc
but I can't get a filtered page.
Am I out of synk on the meaning of these or we must hard-code a "where clause" in second view created with a request parameter?
In other words, what's the best way to do that?
Tank you
Luigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You must'nt hardcode this. Have a look at the bookstore test pages with position and try the childField and parentField values of the goto button.
See taglib doc for more...
Cheers
Henner
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
... but simply the second view is opened unfiltered!
I don't know how dbforms works in the deeps but it seems that the value of CUSTOMER_ID that must be used from the destination view is missing.
have you done something like that or have same idea on what it's wrong?
I think that docs in this area needs more details
tank you
Luigi
----------------------------------------
1) from guide
linkURL - generates a link to a DbForms View
generates a link to a DbForms View. Setting the positionattribute will force DbForms to navigate to this position within the destination-table
2) from reference
gotoButton - button for jumping to other jsp
The gotoButton tag can be used to forward processing to another JSP. Setting the position
(via various gotoButton attributes) will force DbForms to navigate to this position within the destination-table.
parentField / parentField
childField used in sub-form: field(s) in this form that is/are linked to the parent form
Should either be a key or set to sortable="true"in dbforms-config.xml
It seems that the attribute singleRow=true is mandatory ad so are parentField and childField.
but...
from docs:
singleRow
---------
if set to true, only one row of data will be fetched. default is false, so that allrows of data will be fetched and the requested record will be set as actualrecord.
This is not true, if set to true not only one row is fetched but ALL rows matching the specified filter (with pos I suppose)
parentField and childField
... used in sub-form: field(s) in the main form that is/are linked to this formShould either be a key or set to sortable="true"in dbforms-config.xml
This is not exactly true, we are using this attributes ALSO to link to a different page not a subform!
I need some debug session to understand :-(
cheers
Luigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another point: singleRow in child/parent relations is the child with all rows setted to an single parent row.
Maybe that's not a good documented. Feel free to change the text and send me the changes.
I will work it into the docs then!
Thanks
Henner
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm tryng to open list view filtered by the value of selected row in a preceding list view.
This forms are based on different tables; key fields have also different names.
In details:
- the first view presents a list of customers (table=CUSTOMER, key=CUSTOMER_ID) with associated radio
- the second must presents the orders of a selected customer (table=ORDER, key=ORDER_ID, FK_to_customer_table=ORDER_CUSTOMER_ID)
I searched through dbTags docs and found some tags and attributes that seems can be helpful on that:
- associatedRadio, linkURL, gotoButton tags
- pos, keyTokey, keyTokeyTo ... ecc
but I can't get a filtered page.
Am I out of synk on the meaning of these or we must hard-code a "where clause" in second view created with a request parameter?
In other words, what's the best way to do that?
Tank you
Luigi
You must'nt hardcode this. Have a look at the bookstore test pages with position and try the childField and parentField values of the goto button.
See taglib doc for more...
Cheers
Henner
After having re-read of all docs, references and samples (that I list at the and of this mail) I tryed to solve with this snippet of jsp
<a href="
<db:linkURL href="/ORDERS.jsp" tableName="ORDER" childField="ORDER_CUSTOMER_ID" parentField="CUSTOMER_ID">
<db:position fieldName="CUSTOMER_ID" value='<%=(String)currentRow_Cliente.get("CUSTOMER_ID")%>'/>
</db:linkURL>"
>LNK to <db:label fieldName="CUSTOMER_ID"/>
</a>
The linkUrl generates this url in my first view:
/servlet/control;jsessionid=8F25ED2B471B629F7D713F4D7EA4D9BB?
ac_goto_x=t&
dataac_goto_x_fu=/ORDERS.jsp&
dataac_goto_x_destTable=ORDER&
dataac_goto_x_srcTable=CUSTOMER&
dataac_goto_x_childField=ORDER_CUSTOMER_ID&
dataac_goto_x_parentField=CUSTOMER_ID&
dataac_goto_x_singleRow=false
... but simply the second view is opened unfiltered!
I don't know how dbforms works in the deeps but it seems that the value of CUSTOMER_ID that must be used from the destination view is missing.
have you done something like that or have same idea on what it's wrong?
I think that docs in this area needs more details
tank you
Luigi
----------------------------------------
1) from guide
linkURL - generates a link to a DbForms View
generates a link to a DbForms View. Setting the positionattribute will force DbForms to navigate to this position within the destination-table
<linkURL href="customer.jsp" tableName="customer">
<position field="id" value="103"/>
<position field="cust_lang" value="2"/>
</linkURL>
2) from reference
gotoButton - button for jumping to other jsp
The gotoButton tag can be used to forward processing to another JSP. Setting the position
(via various gotoButton attributes) will force DbForms to navigate to this position within the destination-table.
parentField / parentField
childField used in sub-form: field(s) in this form that is/are linked to the parent form
Should either be a key or set to sortable="true"in dbforms-config.xml
3) frm samples
testPosition.jsp
testPositionAuthorEdit.jsp
testPositionAuthorViewEdit.jsp
I just changed the example test page - here is the snippet:
<db:gotoButton
caption="gotoBooks"
destination="/tests/testBOOKSList.jsp"
destTable="BOOK"
parentField="AUTHOR_ID"
childField="AUTHOR_ID"
destPos='<%= position_AUTHOR_VIEW%>'
singleRow="true"
/>
Feel free to write a help text in the wiki!
Thanks
Henner
A very big tank you! It works!
Now I like to understand how it works.
It seems that the attribute singleRow=true is mandatory ad so are parentField and childField.
but...
from docs:
singleRow
---------
if set to true, only one row of data will be fetched. default is false, so that allrows of data will be fetched and the requested record will be set as actualrecord.
This is not true, if set to true not only one row is fetched but ALL rows matching the specified filter (with pos I suppose)
parentField and childField
... used in sub-form: field(s) in the main form that is/are linked to this formShould either be a key or set to sortable="true"in dbforms-config.xml
This is not exactly true, we are using this attributes ALSO to link to a different page not a subform!
I need some debug session to understand :-(
cheers
Luigi
No, they are not mandatory. You can use the goto button without singleRow and parent/child for other purpose!
Henner
Another point: singleRow in child/parent relations is the child with all rows setted to an single parent row.
Maybe that's not a good documented. Feel free to change the text and send me the changes.
I will work it into the docs then!
Thanks
Henner