Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Programming [Next] and [Previous]

 
Bharat Shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First a quick background:

I am trying to create a form where the user can 'browse' records in a table by clicking a <Next> or <Previous> button.

The table has FIELD_ONE, FIELD_TWO and FIELD_THREE as primary key and the browsing is by design based on these three fields with sort order as FIELD_ONE/ FIELD_TWO / FIELD_THREE.

It is possible for FIELD_THREE to have <null> values.


Now, for my problem:

The <Next> button works just fine, even with records with <null> values in FIELD_THREE. Here is the 'script' I use to implement the <Next> logic:



HOWEVER, the <Previous> script does not work. While browsing backwards in a table, it works fine until it reaches a record that has <null> in FIELD_THREE, and then (on clicking <Previous> it skips the record just previous to the record with <null> in it.

Here is the 'script' to implement <Previous>, which is a 'mirror' of that for <Next>:



Any suggestions on what is going wrong?

Thanks in advance.
 
Bharat Shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I resolved the issue by making changes to the table design, where I no longer allow FIELD_THREE to be null. In the table, I fill in any null values in FIELD_THREE with spaces.

That also results in simplified query (the 'is null' check is not required).

Thank you.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bharat,
Thanks for posting the solution so that others who see this thread in the future can benefit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic