Filtering a Many-to-Many browse with PROP:SQL issue

I have this SQL code that works perfect in SQL Management Studio:

select * from orders
join isassigned on (Orders.Orders_SysID = isassigned.ORDERS_ID)
join Assignment_ on (isassigned.ASSIGNMENT_ID = Assignment_.Assignment_SysID)
where Assignment_.AssignedTo = ‘Rick’

I place it into this embed point: Reset Procedure(BYTE Locate), Virtual as:


SELF.View{ PROP:SQL } = '(select o.catalognumber, o.compound_name, o.purchaseordernumber, ’ & |
'o.customercode, o.institution, o.datepromised, o.group_, o.quotenumber, o.attention, ’ & |
'o.invoicenumber, o.dateshipped from orders o ’ & |
'join isassigned on (o.Orders_SysID = isassigned.ORDERS_ID) ’ & |
'join Assignment_ on (isassigned.ASSIGNMENT_ID = Assignment_.Assignment_SysID) ’ & |
‘where Assignment_.AssignedTo = ‘‘Rick’’)’




The format of this code is from this thread:

I have ordered the fields in the SQL syntax according to the order in the database.

I’m still getting one error: “Error: ( (01S01)) attempting to access a record from the dbo.Orders file. Returning to previous window.” Followed by: “Error ( (0) attempting to open curent VIEW. Filter and Range Limits ignored”. Followed by the same error as the first, then closes the browse.

I’m still searching, but any help would be appreciated.


I’d use Clarion driver trace to look at what’s actually sent. It usually helps me.

Are you using simple quote o double?

I’m using single quotes.

I did a quick look for this tool. Are you referring to the one in the driver settings within the dictionary? or is there a separate app?

There’s a tool that sets info in an INI file, or you can set properties on an individual file.
So a couple of different methids.

Okay, going back to basics. From the snippet posted, it seems you are using ABC templates.
Unless the SQL is extremely simplified for what you actually want, it looks to me as if this query can easily be achieved using a standard ABC browse. Why complicate with PROP:Sql?

Thanks for the info. I’ve attached the trace file generated.Shipping Feb 24 2021 - 0001 - Notepad.pdf (144.4 KB)

I am using an ABC browse. I have tried to achieve this using the templates, but have been unable to get it to give the desired output. The result set I’m looking for is to filter the browse so that only projects assigned to the logged in user show up. There are two tabs, one showing current orders and the other is order history, so I have conditional filtering on the tabs also. There are over 100,000 records and it seems to run a bit faster when I use SQL:prop for other queries. There are also other filter options on the browse from radio button choices. I honestly have not been very successful getting many-to-many relationships to work properly in my applications. I’ve read many articles on the subject, most of them in Dave Harms, Tips and Tricks books. Anyway, any articles that would help to explain the implementation of using many-to-many relationships would be appreciated, along with explanations of embed points.

I have exactly the same requirement in my Apps. By far, the easiest solution (in code and especially maintenance) is to create an SQL view in the backend and define that view as a table in Clarion. This is especially true if you need to show summary totals in your browse.

My suggestion would be to work up a quick browse test after creating one example SQL view and that view as one table in the DCT.

Ok. I’ve never created a view in the backend, but I will give it a go and try the test. I’m always interested in learning new things. Thanks!

Careful, you might become addicted. It will open a whole new world as to what you can provide using Clarion.

I agree a VIEW on the backend can be a wonderful thing. Clarion treats them the same as a normal table.

On the trace you provided (Which I haven’t been too far into) I Noticed this line


You might want to investigate