Hi everyone
I have read a number of threads on here which have been very useful but I'm still having trouble and wondering if anyone can help. (I'm using Progress 9.1E and ADM1 btw).
I have 2 tables, JobHdr and JobDet (job header and job details respectively), of which there may be multiple JobDet records per JobHdr (which are linked by the field JobId). The maintenance of these records is in a window which uses a SmartFolder and 2 pages (1 for each of JobHdr and JobDet). Each window has a SmartBrowser and a SmartViewer.
The JobDet SmartBrowser has the query "FOR EACH JobDet WHERE JobDet.JobId = JobHdr.JobId NO-LOCK" and has JobHdr as an external table so it knows which JobId to use.
I'm trying to write a generic include file for all my browsers (smart or non-smart) that will allow column sorting (ascending and descending), which I'm putting in the START-SEARCH code for the browser. The idea is to change the query so that for example it reads like "FOR EACH JobDet WHERE JobDet.JobId = JobHdr.JobId NO-LOCK BY Quantity" (if I've clicked the JobDet.Quantity column).
Everything works fine...except when the browser uses external tables. If I try to use the QUERY-PREPARE method then it complains with the error "JobHdr JobId must be a quoted constant or an unabbreviated, unambiguous buffer/field reference for buffers known to query br_table"
The problem is definitely to do with the external table reference, because if I hard-code the query to be "FOR EACH JobDet WHERE JobDet.JobId = 1 NO-LOCK", for example, then all works fine.
I tried to create a dynamic buffer and dynamic query to obtain the value of the current JobHdr.JobId record (using BUFFER-VALUE) so that I could substitute the actual value into the QUERY-PREPARE method, but it is proving more difficult than I thought.
Does anyone know how to solve the final part of this puzzle or know of an easier way to do it? If you require any more information, eg. the full code listing from the include file, please ask. Thanks
I have read a number of threads on here which have been very useful but I'm still having trouble and wondering if anyone can help. (I'm using Progress 9.1E and ADM1 btw).
I have 2 tables, JobHdr and JobDet (job header and job details respectively), of which there may be multiple JobDet records per JobHdr (which are linked by the field JobId). The maintenance of these records is in a window which uses a SmartFolder and 2 pages (1 for each of JobHdr and JobDet). Each window has a SmartBrowser and a SmartViewer.
The JobDet SmartBrowser has the query "FOR EACH JobDet WHERE JobDet.JobId = JobHdr.JobId NO-LOCK" and has JobHdr as an external table so it knows which JobId to use.
I'm trying to write a generic include file for all my browsers (smart or non-smart) that will allow column sorting (ascending and descending), which I'm putting in the START-SEARCH code for the browser. The idea is to change the query so that for example it reads like "FOR EACH JobDet WHERE JobDet.JobId = JobHdr.JobId NO-LOCK BY Quantity" (if I've clicked the JobDet.Quantity column).
Everything works fine...except when the browser uses external tables. If I try to use the QUERY-PREPARE method then it complains with the error "JobHdr JobId must be a quoted constant or an unabbreviated, unambiguous buffer/field reference for buffers known to query br_table"
The problem is definitely to do with the external table reference, because if I hard-code the query to be "FOR EACH JobDet WHERE JobDet.JobId = 1 NO-LOCK", for example, then all works fine.
I tried to create a dynamic buffer and dynamic query to obtain the value of the current JobHdr.JobId record (using BUFFER-VALUE) so that I could substitute the actual value into the QUERY-PREPARE method, but it is proving more difficult than I thought.
Does anyone know how to solve the final part of this puzzle or know of an easier way to do it? If you require any more information, eg. the full code listing from the include file, please ask. Thanks