Searching into multirecord or grid entity

Author: gianni.sandigliano@unifacesolutions.com (gianni)

Hi, we got a request from a customer to implement a generic search functionality on a whatever column in an entity managed either with multirecord occurrences or within a grid. We cannot use the column header to implement such generic search in both cases because header is already dedicated to sort the entity; we agreed to start this requested functionality from the panel associated to the form. We would like to implement it in a generic way without having to modify each single form... :-) The first implementation did not interact with the user but searched for a fixed string; it worked... Then a very simple form was added to enable user to type the string to be searched together with two buttons: search next    = search next occurrence containing the typed string in the selected column accept             = exit accepting current occurrence while quit was simply associated to standard X caption. Exiting from the form, either with "search next" or "accept" a video refresh is done using show instruction; we can see, either the multirecord or the grid correctly updated, with the cursor moving through searched occurrences and with debug we see $curocc is correctly updated. Everything seems to properly work but when accepting and last instruction from the panel is executed (a done instruction) Uniface runtime is automatically re-positioning the cursor back on the starting occurrence where the right click was initially issued. If we take out the interactive form and reproduce the same functionality without interaction (as example: search third iteration of (sub)string "sample") everything is working again and the cursor remain on last occurrence found (in the example the third containing a "sample" (sub)string). Has anyone already found the described behaviour ? Why URuntime position the cursor back into the original starting occurrence but only when an interactive form is used ? Potentially we could split the interactive form requesting the string to be searched from the search itself but we do not like it this way and the customer does not like it either because user interaction is reduced... :-( Has anyone already implemented a generic search like the one described? Thanks for any suggestion/answer... Gianni

1 Comment

  1. Hi Gianni, looks like we had a similar encounter in a project with tab and formcontainers (u96): User is positioned in the detail form (tab widget) and selects another occurence in the parent multi-occ form or pushes a button: The OGF in the parent form is NOT executed, when the detail form loses focus trigger uses an askmess to save modified data. So for the user it looks like he has not pushed the button correctly and he pushes it again, but our debugger clearly shows something is done under the hood.


    Author: ulrich-merkel (ulrichmerkel@web.de)