Local Views vs Remote Views

The place for users to ask questions and make suggestions related to the ProMatrix Forums operation and organization.

Local Views vs Remote Views

Postby fporratar » Sun Apr 28, 2013 9:41 pm

Hi,

Im having problem to run this code:

If seek(This.value,"CASOS_VIEW","NUMREF") AND !EMPTY(This.value)

I have a table called CASOS, a local view called CASOS_VIEWS and a Remote view called CASOS_VIEWS, actually the table CASOS only has 2 records and the remote view in SQL Servr has 100,000+ records, when I use the localtoremote in the form it works greate but if I want to search withing the code using the seek command is keeping the casos_view empty and therefor no records is found.

Is there another way I can manipulate the views in code in order to use the local view but referencing the remote view?
fporratar
 
Posts: 10
Joined: Sun Mar 03, 2013 10:07 pm

Re: Local Views vs Remote Views

Postby stecenko » Mon Apr 29, 2013 12:14 am

I'm assuming that some place before the seek is performed, you are populating the cursor.

If that's the case, check there that you actually have something in the cursor.

After the cursor has been populated a seek will not make it empty.

The seek may fail, i.e. the value you are seeking may not exist in the cursor, but, a seek cannot 'keep the casos_view empty."


Are you using VPME 9.0 or VPME 9.1?
Richard Stecenko
Interactive Computer Services Inc.
Victoria, British Columbia
204.453.2052
stecenko
 
Posts: 822
Joined: Mon Jun 21, 2010 8:06 pm
Location: Saanich, British Columbia

Re: Local Views vs Remote Views

Postby fporratar » Tue Apr 30, 2013 1:52 pm

Hi Stecenko and thanks for the reply, basically how I fill the cursor "view"? Im making a requery(casos_view) without any parameter so, it suppose to fill the casos_view with all the rows right? and then I make the Seek, but the seek isnt finding any row anyway. The seek method works the same with tables and with views?

Regards
fporratar
 
Posts: 10
Joined: Sun Mar 03, 2013 10:07 pm

Re: Local Views vs Remote Views

Postby stecenko » Wed May 01, 2013 1:10 am

Here are some ways of doing this.


assuming: numref is character and you have a filter on the view
casos.numRef=?getNumRef

The following will populate the cursor only with the required records.
dimension dlaFilters[1,2]
store 'getNumRef' to dlaFilters[1,1]
store this.value to dlaFilters[1,2]
thisform.oVpmDataHandler.requeryView('casos_view', @dlaFilters)

If you have for some other reason, you have to populate casos_view with all the records and then want to find just one record, then
thisform.oVpmDataHandler.requeryView('casos_view') && populates with all records
select casos_view
if locate for numRef=This.Value and not empty(this.value)
* do what you need for this record
endif

If you will have more than one record for numref, then
thisform.oVpmDataHandler.requeryView('casos_view') && populates with all records
select casos_view
if locate for numRef=This.Value and not empty(this.value)
scan while numRef=this.Value
* do what you need for these records
endscan
endif


The seek only works if you have an index created after the view is populated. I'm assuming that the view has order by numref. So often it will be faster to read through the view until you find the first record with numref=this.value, than it is to build the entire index on all records before you can test to see if you even have a record to process.

Reading through the entire view to locate a particular numRef will take less time than building an index.

When you do a locate you are reading every record until you either find one that you want or reach the end of the view. When you build an index you are reading every record and writing it to an index; then you can seek to see if one of them is what you want.

I hope this helps. I'm not sure how big casos_view is or what you're going to do with it. But, this should give you some idea on how to figure out what to do.
Richard Stecenko
Interactive Computer Services Inc.
Victoria, British Columbia
204.453.2052
stecenko
 
Posts: 822
Joined: Mon Jun 21, 2010 8:06 pm
Location: Saanich, British Columbia

Re: Local Views vs Remote Views

Postby fporratar » Wed May 01, 2013 1:36 pm

Hi Stecenko,

Thanks for the reply, I will try the code You told me here....

Regards
fporratar
 
Posts: 10
Joined: Sun Mar 03, 2013 10:07 pm

Re: Local Views vs Remote Views

Postby fporratar » Sat May 04, 2013 12:25 am

Hi Stecenko,

The code proposed works just fine... Thanks I have another request, I dont know if I can write extensible here at the forum, but Im trying to acomplish a Relation between 2 screens and sometimes works other dont.. Could you please be so kind to let me write to your personal email to explain the situation?

Regards
fporratar
 
Posts: 10
Joined: Sun Mar 03, 2013 10:07 pm

Re: Local Views vs Remote Views

Postby stecenko » Sat May 04, 2013 12:38 am

Richard Stecenko
Interactive Computer Services Inc.
Victoria, British Columbia
204.453.2052
stecenko
 
Posts: 822
Joined: Mon Jun 21, 2010 8:06 pm
Location: Saanich, British Columbia

Re: Local Views vs Remote Views

Postby fporratar » Sat May 04, 2013 5:16 pm

Thanks for the email, another question, What we are trying to do here is convert an VPM application to the 9.1 Version, and to change some of the tables to SQL server, In case we need your assistance You will be able to help us, and billing us by hour?

I will prepare the email so You can understand our system and if it something You have to intervine with, then we can talk about the job.

Regards
fporratar
 
Posts: 10
Joined: Sun Mar 03, 2013 10:07 pm

Re: Local Views vs Remote Views

Postby stecenko » Sat May 04, 2013 6:46 pm

Sure, let me know what you are up to. If there are some forms you are having a problem with, I can give you a quote on doing them.

Which SQL server are you using? I've used DB2, MySQL, and MS SQL. Currently, I'm using MS SQL Express 2012.
Richard Stecenko
Interactive Computer Services Inc.
Victoria, British Columbia
204.453.2052
stecenko
 
Posts: 822
Joined: Mon Jun 21, 2010 8:06 pm
Location: Saanich, British Columbia

Re: Local Views vs Remote Views

Postby fporratar » Sat May 04, 2013 10:17 pm

Thanks Richard,

For now do you have any checklist to make the relation between forms: table to view, view to view and table-view-remote view. That the main problem we have. Later I will send You a detail email with the details. BUt for now is there like a check-list for setting the relations?

Regards
fporratar
 
Posts: 10
Joined: Sun Mar 03, 2013 10:07 pm

Next

Return to ProMatrix Forums User Questions / Suggestions

Who is online

Users browsing this forum: No registered users and 3 guests

cron