How do you moderanize VPME applications?

The place to discuss and announce issues that don't relate directly to ProMatrix, but that are of interest to ProMatrix users. Feel free to use the Chatter forum as you like (as long as your use is in good taste).

Re: How do you moderanize VPME applications?

Postby stecenko » Tue Aug 23, 2016 10:55 am

Just curious...

Is it important to have a CursorAdapter only project? Why?

I did once try to use CursorAdapters; I can't remember why. But, it seemed difficult and I didn't see any advantage.

If you have the time, can you explain what they offer that views don't?
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

Cursor Adapter Advantages

Postby Abbas » Tue Aug 23, 2016 2:31 pm

I have .net and vb6 background and cursoradapter seems natural and flexible to me.

1. You can create a base cursoradapter class and then inherit other cursoradapter classes from it. You can find caBuilder utility (which can be found in vfp forums) and create cursoradapter classes in one go. I think someone can create this kind of utility for VPME also and create all the required cursoradapters.

2. You can specify select, delete or update comands/sqlstatements the way you want.
For example, if you are saving an invoice, at the same time you are also updating customer balances, and sales order balance etc., and posting it to G/L on the server side. You can also use stored procedures for these commands which common in the .net world. You might want to post the invoice in general ledger at the time of save.

I have inherited a DB and it contains all the logic built in stored procedures. I don't think this kind of functionality can be achieved with views. If it can be, please advise.

Thanks
stecenko wrote:Just curious...

Is it important to have a CursorAdapter only project? Why?

I did once try to use CursorAdapters; I can't remember why. But, it seemed difficult and I didn't see any advantage.

If you have the time, can you explain what they offer that views don't?
Abbas
 
Posts: 26
Joined: Sun Jul 25, 2010 11:41 am

Re: How do you moderanize VPME applications?

Postby stecenko » Tue Aug 23, 2016 4:38 pm

You can use SQLExec in VFP for stored procedures.

https://msdn.microsoft.com/en-us/librar ... 83(v=vs.71).aspx
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

How to retrieve auto-incremented ID fields from DB?

Postby Abbas » Tue Aug 23, 2016 7:28 pm

Using cursoradapter it is easy to retrieve auto-incremented or other db populated values by just setting two properties of sqladapter:
If you work with SQL Server:
Code: Select all
adapter.InsertCmdRefreshCmd = [SELECT custid FROM cust WHERE custid = @@IDENTITY]
adapter.InsertCmdRefreshFieldList = [custid]


How can you achieve the same effect with views?

Thanks
Abbas
 
Posts: 26
Joined: Sun Jul 25, 2010 11:41 am

Re: How do you moderanize VPME applications?

Postby stecenko » Wed Aug 24, 2016 11:18 am

I don't use auto-incremented. I'm was never a SQL developer; I started with VFP. And I've never inherited an exisitng SQL application. So my tendency is to do things in VPME rather than in SQL.

I use the data manager to set defaults and I use GUIDs for keys.

Are all your posts so far because you have an existing SQL application that you must conform to?
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: How do you moderanize VPME applications?

Postby Abbas » Wed Aug 24, 2016 11:20 pm

stecenko wrote:Are all your posts so far because you have an existing SQL application that you must conform to?


Primarily Yes. and it can nicely be done with VPME using cursoradapters.
Just want to explore in depth before I start creating a production application using this technology.
Abbas
 
Posts: 26
Joined: Sun Jul 25, 2010 11:41 am

Reason for saving CHILDREN before the PARENT?

Postby Abbas » Sat Aug 27, 2016 9:35 am

Hi Richard
What do you think is the reason for saving child records before the parent?
I don't see any valid reason. I think it is based on the assumption that parent is already saved before the children. Even then they have implemented the logic to save the parent first in the SaveRecord method.

Thanks
Abbas
 
Posts: 26
Joined: Sun Jul 25, 2010 11:41 am

Re: How do you moderanize VPME applications?

Postby stecenko » Sat Aug 27, 2016 11:54 am

You have to save one of them first.

It could be that within a transaction, you want to be sure all the children can be saved before saving the parent.

The reason for saving the parent first is to know the primary key of the parent so it can be included in the children.

But, by using GUIDs for the primary key that problem is solved.

If you look at the code in VPME, you will see that all the meta data using GUIDs for primary key. I assume that once you've made that one of the underlying tenets of your programming style, then other decisions follow from it.
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

One-To-Many Form Save In OneGo

Postby Abbas » Sat Aug 27, 2016 9:18 pm

Have changed the code to achieve the task. Now no need to save parent record before adding the child.
The save method now saves parent first and then children.
FK is automatically updated in the child records before save.

Have tested it and form is working good.
Abbas
 
Posts: 26
Joined: Sun Jul 25, 2010 11:41 am

Previous

Return to Chatter

Who is online

Users browsing this forum: No registered users and 1 guest

cron