Hi,

I have a query in dbforms-config.xml:

<table name="school"
  defaultVisibleFields="schoolId" >
  <field name="schoolId" fieldType="int" size="10"
    isKey="true" autoInc="true"/>
  <field name="name" fieldType="varchar" size="100"/>
</table>

<table name="student"
  defaultVisibleFields="studentId" >
  <field name="studentId" fieldType="int" size="10"
    isKey="true" autoInc="true"/>
  <field name="schoolId" fieldType="int" size="10"
    isKey="true"/>
  <field name="name" fieldType="varchar" size="100"/>
</table>


<query name="schoolList"
  distinct="true"
  from="school
  LEFT JOIN student
  ON school.schoolId = student.studentId">
  <field name="school.schoolId" isKey="true"/>
  <field name="school.name" sortable="true"/>
  <!--
  <field name="student.studentId"/>
  -->
</query>

Now, my dbforms-tag in jsp is:

// Filter is something like
<% String filter = "...something..."; %>

<db:dbform
  tableName="schoolList"
  maxRows="15"
  bypassNavigation="false"
  orderBy="school.name"
  filter="<%= filter %>">

...

So, this is working fine. I can use navigation in page (list of schools), because I 
have a query in dbforms-config and I only have to use filter in in dbform-tag. But if 
I want to use student.studentId in filter, something like like:

<% String filter = "...something...,student.sudentId=" + student.getStudentId() + ""; 
%>

I have to take in use <field name="student.studentId"/> tag in dbforms-config. And 
this causes problem, because query's rows are not distinct anymore, so I naturally get 
a list of schools multiplied by the number of students. And I dont need the 
student.studentId in the list.

So, it looks like that filter in dbform-tag requires that the field is represented in 
the query in dbforms-config.xml. I have all the table fields in table definitions. 
Otherwise I get an exception:

INFO org.dbforms.taglib.DbFormTag  - doCatch called - java.lang.NullPointerException

I'm I right or am I doing something wrong. And is other way to do this filtering and 
still use page navigation. I know that this example is simple and can easily be done 
in a different way. But my actual query is quite complex and it uses different kinds 
of filters and it would be really big work to write different kinds of queries for 
different filters.

Regards,
Salient
-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
http://corp.mail.com/careers



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
_______________________________________________
DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to