progress 4gl:how to retrive database record that satisfies all the keywords entered by user in fill-in-field -
the keywords entered user i.e number of keywords,it may 1 or more. take fill-in-field taking input , search pairs of keywords match database record means ,i display on browse...but record must satisfy keywords entered user,if not satisfied means,it display individual keyword result. thankyou sir-------the code write
::::assign entrycount = (num-entries(hi:screen-value)). repeat pos = 1 entrycount : assign keywordi = entry(pos,trim(hi:screen-value)). each db1.vehicles vehicles.ad-num matches keywordi or string(vehicles.sl-num) matches keywordi or vehicles.product-id matches keywordi or vehicles.product-name matches keywordi or string(vehicles.amount) matches keywordi no-lock: each db2.service db2.service.ad-num = db1.vehicles.ad-num no-lock: /* if vcount eq 0 , scount lt 1 */ /* do: */ find ttservice ttservice.service-num = service.service-num no-lock no-error . if available ttservice do: end. else do: create ttservice . assign ttservice.ad-num = vehicles.ad-num ttservice.sl-num = vehicles.sl-num ttservice.sl-id = service.sl-num ttservice.product-id = vehicles.product-id ttservice.service-num = service.service-num ttservice.product-name =vehicles.product-name ttservice.purchase-amt = vehicles.amount ttservice.service-amt = service.service-amt no-error . end. end.
well, dynamic query wouldn't suffice here, because want search every entry against every field. , wouldn't work, because you're not adding wildcards -> * strings. see, in progress
display 'myhappyexample' matches 'happy'.
returns false, while
display 'myhappyexample' matches '*happy*'.
will give true state. amount of or clauses, added conversion of fields on left side, throw performance out window. if still pursue this, take @ answer posted on other thread
stackoverflow.com/questions/30210548/progress-4gl-how-to-retrive-record-from-database-which-satisfies-multiple-keywo/30214270?noredirect=1#answer-30225957
and if you'd pursue more elegant solution using dynamic queries (but should ask user select fields want filter, , build csv those, , enter filters in order of fields want search, @ answer posted:
stackoverflow.com/questions/30210548/progress-4gl-how-to-retrive-record-from-database-which-satisfies-multiple-keywo/30214270?noredirect=1#answer-30239320
in fact, i'd suggest interface user select fields wish filter, allow them enter values want filter specific field, use dynamic queries build that. more performance-wise efficient, in opinion.
anyway, let me know, hope helps.
Comments
Post a Comment