NetTalk Central

Author Topic: NetWebBrowse missing records  (Read 3823 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
NetWebBrowse missing records
« on: September 29, 2009, 05:07:35 PM »
Hi
I have a browse on a MSSQL backend where I have overridden the view using prop:sql in the AfterSetview embed.
I use dummy file with 5 fields and a key made up of all fields as the unique key.
There are no filters in the template.
When I run the browse on the web, it returns 102 records, yet when I run in query analyzer it returns 113 records.  :-\
I ran TRACE and found that the query and backend were returning all 113 records!
(I was kind of hoping it was my query)

So I omitted all the code in the browse from AfterSetView all the way down to InsideBrowseLoop - 2 End of Loop

In AFterSetView, after setting the view, I put -
  If loc:LocatorBlank = 0 or Loc:LocatorValue <> '' or loc:LocatorType = Net:Position or loc:LocatorType = Net:None
  Loop

    Next(ThisView)
    If errorcode()
        BREAK
    END
 OMIT('***USEMINE***')


In End of Loop I put -
***USEMINE***
loc:viewstate = p_web.escape(p_web.Base64Encode(clip(DUM:col5)))
do BrowseRow

Now it returns all 113 records! ;D

BUT WHY do I have to do this? ???
AND  What does this mean regarding other browses? Do I need to double check each one? :-\

Has anyone else seen this behavior?
I'm running 4.37.

<-Edit-> This is a file loaded report - no locators, no sorting, no ranges, no filters, no buttons except the close button, green bar is checked, Show column Headings is checked, no children, user must be logged in and Ignore Key not being unique is checked.
<-End Edit ->

Chris

« Last Edit: September 29, 2009, 05:12:55 PM by ccordes »
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebBrowse missing records
« Reply #1 on: September 29, 2009, 10:31:18 PM »
Hi Chris,

As you might imagine the management of the View for browses is by some distance the most "complex" thing the template does. There are a lot of things to balance so that proper page loading (or file loading), backfilling (or not), and different drivers etc are all supported. Even small changes can have dramatic effects.

I'm not 100% sure what you mean though when you say you're overriding the View with a prop:Sql. Because there is no Prop:Sql property for a View. That only works on Files.

If you want to override the view filter, then by all means override the view filter before the call to SetView. It's important that the filter is set before the call to SET the view. I'd recommend using SQL or SQLFILTER statements inside the filter if you want tighter control.

Cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NetWebBrowse missing records
« Reply #2 on: September 30, 2009, 06:04:29 AM »
 ??? From the Clarion Help - "Note:   When you issue a SELECT statement using PROP:SQL, the selected fields must match the fields declared in the named file or view. In addition, if you use VIEW{Prop:SQL} to issue a SELECT statement, the fields in the SELECT must be ordered based on the field order in the file definition, not the PROJECT  sequence."
... and yes my return matches the file layout, and I project  the fields in the same order just in case.

I may have been doing this wrong for a long time, so I'm surprised that it has worked as well as it has!

Does that mean that I need to set prop:sql on the file before it gets to the view?
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebBrowse missing records
« Reply #3 on: September 30, 2009, 07:09:36 AM »
Hi Chris,

I think you're more of the expert here than I am Chris. I don't use prop:sql.

Personally I'd lean towards using the SQL or SQLFILTER command.

cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NetWebBrowse missing records
« Reply #4 on: September 30, 2009, 09:30:53 AM »
That may be or not, but you're definatly the Browse template expert.

What I've found out is that prop:sql pretty much trumps any other content property. So in the embed, After Setview, I put ThisView{prop:sql} = some select statement. Then the view/browse behaves normally based on that return set. ... as far as i can tell. I haven't used this for page loaded, editable, or sortable browses, but the results from Tracing it show all the correct records coming back as expected.

Since I wasn't checking anything that seemed to do anything I figured the template wouldn't get in the way. Now I find that the totaling/counting is off - it misses the last record.
Any suggestions on that?
<edit -- The totaling is fine, but the counting is off by 1. I have 1 field set to count in the totaling and it is off - -->

« Last Edit: September 30, 2009, 10:02:21 AM by ccordes »
Real programmers use copy con newapp.exe