StrataFrame Forum

Is it possible to add a filter condition to what gets displayed in the BrowseDialog?

http://forum.strataframe.net/Topic29706.aspx

By Marcia G Akins - 3/14/2011

Hi All.

I am working on an application where there is an application level filter in effect by user. I would like to use the BrowseDialog to allow the users to search for records but only within a subset that satisfies the filter condition.

Is it possible to do this?

TIA

Marcia
By Edhy Rijo - 3/14/2011

Hi Marcia,
Yes, you can do all that.  Take a look at the Browse Dialog topic in the UI Layer in the help file.  There is a "Visible" property that will allow you to show/hide any search field, also you can set a default value programatically without user know about it.
By Marcia G Akins - 3/14/2011

Hi Edhy.

Thanks for the quick response. I have done what you suggested before for simple filter conditions. However, this one is a bit more complex. It would be something like this:

ProviderID IN (2, 4, 6, 8, 10)

Can I do something like that with an invisible field?

TIA

Marcia
By Aaron Young - 3/14/2011

Hi,

I wonder if your intention is to filter the results of the search query? If so, you can add a where clause in the BrowseDialog_Searching event. The following example adds a where condition that only returns records which have two fields equal to 0:-

// Add a "Where" clause to only include records where FIELD1 = 0 and FIELD2 = 0

System.Collections.ArrayList value = new System.Collections.ArrayList();

value.Add(0);

MicroFour.StrataFrame.Data.
WhereStatement where1 = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "FIELD1" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.Equals);

e.RawWhereStatementsCollection.Add(where1);

MicroFour.StrataFrame.Data.
WhereStatement where2 = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "FIELD2" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.Equals);

e.RawWhereStatementsCollection.Add(where2);

Hope this helps.

By Aaron Young - 3/14/2011

Oops, I crossed posts with you.

There is an "IN" clause, i.e. "MicroFour.StrataFrame.Data.WhereStatementTypeOptions.In"
By Marcia G Akins - 3/14/2011

Aaron Young (3/14/2011)
Hi,

I wonder if your intention is to filter the results of the search query? If so, you can add a where clause in the BrowseDialog_Searching event. The following example adds a where condition that only returns records which have two fields equal to 0:-



This is exactly what I want to do! Thanks a million before taxes!

Marcia
By Aaron Young - 3/14/2011

Please don't mention taxes.....
By Marcia G Akins - 3/15/2011

Hi Aaron.

Here is the code that I have in brwPatients_searching method and it does not filter the what is returned - it gives me all the records.

What am I doing that is stupid?

// Add a "Where" clause to only include records where the provider id

// is in the current filter condition

System.Collections.ArrayList value = new System.Collections.ArrayList();

value.Add(
AppMain.Current_Filter);

MicroFour.StrataFrame.Data.
WhereStatement WhereClause = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "ProvID" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.In);

By Marcia G Akins - 3/15/2011

Hi Aaron.

Never mind. I must have taken my stupid pills this morning. Blush I was missing this line of code:

e.RawWhereStatementsCollection.Add(where2);
By Trent L. Taylor - 3/15/2011

Please don't mention taxes.....


Smile  Amen!
By Trent L. Taylor - 3/15/2011

One other thought on this would be to create a View.  The Browse dialog has the ability to change the query table.  This include the support of a view.  You can also change this at run-time allowing you to have multiple views if necessary.  Just another thought Smile
By Marcia G Akins - 3/15/2011

This code is not filtering the result set. Here is what I am trying to do. I am searching for patients but I only want the browse dialog to search patients for one or more specific providers that have been set as an application level filter.

Even with the code in the Searching method, I am still getting all the patients back.

What am I doing wrong?
By Marcia G Akins - 3/15/2011

This code is still not working to filter the result set. This is what I am trying to do. I have an application level filter set up to displat information from one or more selected providers. When I go to select a patient, I want the result set to include only patients for the provider(s) that have been set up as the application level filter.

When I search, all patient records are being returned.

What am I doing wrong?
By Marcia G Akins - 3/15/2011

Trent L. Taylor (3/15/2011)
One other thought on this would be to create a View.  The Browse dialog has the ability to change the query table.  This include the support of a view.  You can also change this at run-time allowing you to have multiple views if necessary.  Just another thought Smile


Can you share some sample code with me? I do not think that the multiple views would work because the user can select one or more providers so the data that the browse dialog runs over would have to change with a dynamic WHERE clause at run time.

TIA

Marcia
By Edhy Rijo - 3/15/2011

Probably this thread can help you out: http://forum.strataframe.net/FindPost23458.aspx
By Marcia G Akins - 3/15/2011

[quote]Edhy Rijo (3/15/2011)
Probably this thread can help you out: http://forum.strataframe.net/FindPost23458.aspx[/quote]

Hi Edhy.

Thanks for trying to help. I don't think that this is going to do what I want. What I really need is for the code that Aaron gave me to put in the BrowseDialog_searching method to work as advertised. I followed his instructions exactly, but the result set was not filtered by the current provider(s).
By Edhy Rijo - 3/15/2011

Marcia G Akins (3/15/2011)
...What I really need is for the code that Aaron gave me to put in the BrowseDialog_searching method to work as advertised. I followed his instructions exactly, but the result set was not filtered by the current provider(s).

I see.  Sorry, I have not used that functionality of the Dialog Browser yet.
By Aaron Young - 3/15/2011

Hi Marcia,

Sorry for the late reply. Is this still your code?

System.Collections.ArrayList value = new System.Collections.ArrayList();
value.Add(
AppMain.Current_Filter);
MicroFour.StrataFrame.Data.
WhereStatement WhereClause = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "ProvID" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.In);

Assuming you are still using the code above, I think AppMain.Current_Filter is the problem. I suspect it is a list of provider ID numbers but they are being added to the value array as a single element. They should be split and added as individual array elements. For example, take a look at this code:-

// This code adds a WHERE clause of "ID IN (10000145, 10000146, 10000149)
System.Collections.ArrayList value = new System.Collections.ArrayList();
value.Add(10000145);
value.Add(10000146);
value.Add(10000149);
MicroFour.StrataFrame.Data.
WhereStatement where1 = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "ID" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.In);
e.RawWhereStatementsCollection.Add(where1);

The above code definitely 100% works so if you can split AppMain.Current_Filter into separate IDs and add them to the array then you could be in luck. If it still doesn't work, can you give me an example for AppMain.Current_Filter?

Aaron
By Marcia G Akins - 3/16/2011

Aaron Young (3/15/2011)
Hi Marcia,

Sorry for the late reply. Is this still your code?

System.Collections.ArrayList value = new System.Collections.ArrayList();
value.Add(
AppMain.Current_Filter);
MicroFour.StrataFrame.Data.
WhereStatement WhereClause = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "ProvID" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.In);

Assuming you are still using the code above, I think AppMain.Current_Filter is the problem. I suspect it is a list of provider ID numbers but they are being added to the value array as a single element. They should be split and added as individual array elements. For example, take a look at this code:-

// This code adds a WHERE clause of "ID IN (10000145, 10000146, 10000149)
System.Collections.ArrayList value = new System.Collections.ArrayList();
value.Add(10000145);
value.Add(10000146);
value.Add(10000149);
MicroFour.StrataFrame.Data.
WhereStatement where1 = new MicroFour.StrataFrame.Data.WhereStatement(new String[] { "ID" }, value, MicroFour.StrataFrame.Data.WhereStatementTypeOptions.In);
e.RawWhereStatementsCollection.Add(where1);

Aaron


Hi Aaron. Thanks so much for all the help you have given me. Everything is working now. The problem was not Current_Filter. I am embarrassed to say that it was the loose nut behind the keyboard Blush