PROP:Sql or PROP:SqlFilter 
Author Message
 PROP:Sql or PROP:SqlFilter

Hi,

Using C55EE(D) ABC

On my app, using SQL tables, i have one browse, and i want to do some
filtering, with radio buttons, and i want to use PROP:Sql or PROP:SqlFilter
to

I've tried putting this code in a button, just to test it.

Queue:Browse:1{PROP:SQL} = 'Select * FROM Headari Where HEA:Tekstur = "Some
Text"'

But what do i need to do after that to get the browse to display the filterd
records ???
i've tried ThisWindow.Reset(1), but does'nt that just reset the browse to
the original state ???

Throw me a bone ehre :) <g>



Mon, 08 Dec 2003 20:24:43 GMT  
 PROP:Sql or PROP:SqlFilter
Hi all,

Quote:

> Using C55EE(D) ABC
> On my app, using SQL tables, i have one browse, and i want to >do some

filtering, with radio buttons, and i want to use PROP:Sql >or PROP:SqlFilter
to
Quote:
> I've tried putting this code in a button, just to test it.
> Queue:Browse:1{PROP:SQL} = 'Select * FROM Headari Where HEA:Tekstur =

"Some Text"'

  I am just moving everything to SQL and so far I have found that the
prop:SQLFilter appears to be a better choice.

   Anyway, derive the BrowseClass and overload the ApplyFilter method and
change the code that assigns the prop:filter to prop:SQLFilter.   Then you
can use ResetSort(true), SetFilter and so on.

    SQLFilter will have a fit with pre:field,  add a little method that will
strip out the prefix and your done.

    Dennis



Mon, 08 Dec 2003 20:41:14 GMT  
 PROP:Sql or PROP:SqlFilter
Hi Dennis,

First of all, Thanx for the rapid answer.
But, i'm affraid that my skill's ar'nt that good to understand you'r reply
:) <s>



Quote:
> Hi all,


> > Using C55EE(D) ABC
> > On my app, using SQL tables, i have one browse, and i want to >do some
> filtering, with radio buttons, and i want to use PROP:Sql >or
PROP:SqlFilter
> to
> > I've tried putting this code in a button, just to test it.
> > Queue:Browse:1{PROP:SQL} = 'Select * FROM Headari Where HEA:Tekstur =
> "Some Text"'

>   I am just moving everything to SQL and so far I have found that the
> prop:SQLFilter appears to be a better choice.

>    Anyway, derive the BrowseClass and overload the ApplyFilter method and
> change the code that assigns the prop:filter to prop:SQLFilter.   Then you
> can use ResetSort(true), SetFilter and so on.

>     SQLFilter will have a fit with pre:field,  add a little method that
will
> strip out the prefix and your done.

>     Dennis



Mon, 08 Dec 2003 21:06:07 GMT  
 PROP:Sql or PROP:SqlFilter
Quote:
>Queue:Browse:1{PROP:SQL} = 'Select * FROM Headari Where HEA:Tekstur = "Some
>Text"'

>But what do i need to do after that to get the browse to display the filterd

records ???

PROP:SQL does not work well with browses.  You can either use PROP:SQLFILTER of
the setfilter method. I would do it one of two ways.
either

BRW1.SetFilter('HEA:Tekstur = ''Some Text''')
Brw1.ResetQueue(Reset:Queue)

OR

BRW1.SetFilter('SQL('TEKSTUR = ''Some Text'')')
BRW1.ResetQueue(Reset:Queue)

assuming TEKSTUR is the column name on the SQL backend.  

If you use the first example you must make sure that HEA:Tekstur is bound.  If
the field is listed in your browse it is no problem but if it is not you must
make it a hot field or Clarion will ignore the filter.

The second version could be rewritten as

Queue:Browse:1{PROP:SQL} = 'TEKSTUR = ''Some Text'''
BRW1.ResetQueue(Reset:Queue)

as well but since the SQL statement is sent directly to the SQL backend you do
not want to use the prefix in any PROP:SQL statement.

Dave Potter



Mon, 08 Dec 2003 21:34:16 GMT  
 PROP:Sql or PROP:SqlFilter
For everything there is a first time.

    Dennis



Tue, 09 Dec 2003 09:13:52 GMT  
 PROP:Sql or PROP:SqlFilter
Ok, i think i understand what you are telling me.
So, i need to make a new class derieved from BrowseClass, and override one
of the functions in the browseclass.

But... how do i know which one it is, and how can i find it, when my class
browser does'nt work, the damn thing. (yes i know about the bug report on SV
site)



Quote:
> For everything there is a first time.

>     Dennis



Tue, 09 Dec 2003 17:09:55 GMT  
 PROP:Sql or PROP:SqlFilter
Hi all,

Quote:

> Ok, i think i understand what you are telling me.
> So, i need to make a new class derieved from BrowseClass, and >override

one of the functions in the browseclass.

   That's all there is to it.

Quote:
> But... how do i know which one it is, and how can i find it, when my class
> browser does'nt work, the damn thing. (yes i know about the bug report on
SV
> site)

  Was not aware of a bug in the class browser, very seldom use the tool.
The doc's would be the best place to start and then the source code files.

Anyway, just open the AbFile.clw file and locate the ViewManager ApplyFilter
method, the last few lines are the part that needs to be altered.

SELF.View{PROP:Filter} = RangeFilter
 IF ERRORCODE()
    SELF.Primary.Me.Throw(Msg:ViewOpenFailed)
END

In your derived BrowseClass the line would read,
Self.View{prop:SQLFilter} = RangeFilter
if errorcode() ...

The BrowseClass is derived from the Viewmanager and your derived class will
be in the same chain.

  The ApplyFilter method is a little large and should have been broken up
into a couple more methods, the range limit part, the filter part and the
assignment part but that is beside the point and also an opinion.   But
since it was not, your derived class will have to repeat most of the code,
not a good way but unavoidable with this particular method.

The easy way is to just copy the method and change the line were the filter
is assigned.   Then tell the browse procedure to use the derived
BrowseClass.

   The prop:sqlFilter, according to the doc's passes the filter expression
as is, so do not forget to remove the prefix, unless the SQL side uses the
same prefix.    In the class I am using I remove them in the SetFilter
method,

  Self.RemovePrefix(f)
  parent.SetFilter(f, Id)

  and in the ApplyFilter method for the range limits,  the original method
will have code like this,

FieldName = SELF.Primary.Me.GetFieldName(SELF.Order.MainKey,I)
        RangeFilter = RangeFilter & CHOOSE....

Add a line between them,

FieldName = SELF.Primary.Me.GetFieldName
Self.RemovePrefix(FieldName)
(SELF.Order.MainKey,I)
        RangeFilter = RangeFilter & CHOOSE

That will get the prefix out of the string that is used by the range limits.

  That's it, looks a lot worse than it really is, once you derive a couple.

    Dennis



Tue, 09 Dec 2003 20:23:25 GMT  
 PROP:Sql or PROP:SqlFilter
If you use PROP:SQL, you don't need to add prefix in your SQL query. I saw
on my tests, standart browse template is not compatible to use PROP:SQL.

Kind Regards,



Quote:
> Hi,

> Using C55EE(D) ABC

> On my app, using SQL tables, i have one browse, and i want to do some
> filtering, with radio buttons, and i want to use PROP:Sql or
PROP:SqlFilter
> to

> I've tried putting this code in a button, just to test it.

> Queue:Browse:1{PROP:SQL} = 'Select * FROM Headari Where HEA:Tekstur =
"Some
> Text"'

> But what do i need to do after that to get the browse to display the
filterd
> records ???
> i've tried ThisWindow.Reset(1), but does'nt that just reset the browse to
> the original state ???

> Throw me a bone ehre :) <g>



Wed, 10 Dec 2003 00:46:10 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Obtain Prop:SQLFilter from Prop:Filter ??

2. Problem in use {PROP:SQLFilter}

3. Embed Point to apply {Prop:SQLFilter}

4. How to Prop:SQLFilter in ABC?

5. PROP:SQLFILTER + ORACLE

6. SomeView{Prop:SQLFILTER} crunches memory > GPF

7. PROP:SQLFILTER

8. PROP:SQLFILTER

9. Error into my Sintax PROP:SQLFILTER!!!

10. Changing PROP:SQLFilter on the fly

11. SQL - How to use Prop:Sql effectively

12. embedded SQL, filename{PROP:SQL}

 

 
Powered by phpBB® Forum Software