Hi,
you can check the duplication on item change event of
dropdowndatawindow column for all rows with loop from 1st Row to last
row
this loop will terminate immediately when a duplicate item found in
the product_id found in the same order and a boolean variable can be
used which will contain true if found duplicate
and after exitting the loop you can check that duplicate variable if
its value is true you can prompt a message to user for duplication
or
you can check duplication when you are about to save the order on pre
update with loop from 1 to all rows of the product detail datawindow.
i will preffer 2nd option coz it will save the processing.
hope it will give you some clue
Regards
Asif Shoukat
Sr. Software Engineer
NetSol Technologies Limited
www.netsoltek.com
1. Find the product id and deleterow.
2. Set filter to "product_id <> 'prodid1' AND product_id <>
'prodid2' ... this is better - only one retrieval
When user starts a new order re-retrieve dddw (if you
deleted the rows) or set filter to ''
If that returns a value > 0, you have a duplicate, and you can flag the
error.
I usually try and prevent someone from making an error, rather than let them
and throw an error message, but this is 1 line, and it's pretty quick to
implement.
Paul Horan[TeamSybase]
<ghkum...@yahoo.com> wrote in message
news:45d3e844.27f...@sybase.com...
Personally, I prefer Paul's suggestion, it's simple and
straight forward. Also, filtering or deleting rows from a
child datawindow will definitely require a lot of coding,
why?
- If you use delete, what if the user goes back to that row
and edits that column again? You have to move that row (and
that row only) from the deleted buffer to the primary buffer
again (haven't tried though, since I'm not sure if deleted
buffer exists for child datawindows). Also, after doing
that, you have to delete that row again.
- If you use filter, you have to track all IDs that are
already selected in other rows (besides the current) and
apply that as the filter. If you code the filtering in the
dropdown user event (pbm_dwndropdown), its quite easy,
however, you have to trap also the keystrokes (say, arrow
down and arrow up). Probably better yet code this on the
itemfocuschanged and/or rowfocuschanged).
But again, it is a lot of work compared to the one liner...
HTH,
Arman
.... in the help file.