How to SUM child BO field into parent


Author
Message
Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Dustin,

Tks for your explanations.

Les,

Oh my... I´ve read an example from your site about security, we´re working on that right now on our system.
It´s really amazing, congratulations!!!

PS: Let´s to wait the new calendar for courses... I will pratice my "Brazilian Indian English" and take the journey!!!!Cool

See ya guys.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad that sample helped!
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
1) Les has some good articles on his site that would definately help you get your feet under you, and cover several things not in the standard SF documentation. Outside of that, no, we don't have any unreleased documentaiton in PDF format, but we will be releasing the next official point release soon which will have some additions to the documentation to cover some new features.

2) We don't currently have the next training course on the calendar (we schedule them based on developer availability and user demand.) That said, when it does come around I think the course would be very helpfull for beginning programmers. The curriculum is written in a way that it is accessible to anyone with a basic knowledge of strataframe and programming concepts in general.  Granted, some of the back-end, data layer concepts and the like may go deeper than you are interested in, but even that is good to hear if just for a basic understanding of how things fit together.

Glad to hear things are going well for you Smile

Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Les,

1-) Is there some unleashed documentations in PDF format?
2-) What do you think about your courses for beginners programmers?

In 2007/2008 I had a team specialized in C# and I didn´t write a single line of code, but in last year I decided to quit my employees and prepare myself, my partner and a new team with trainees.
This is was the best choice, because I know the whole development proccess and concepts and the new team have no vicious.BigGrin
The Rule is: Learn right to get the best for RAD Framework!

I have 25 years of development experience, since from: Cobol and Clipper years, Delphi, Centura, Genexus, Clarion and the best one: SF!!!!!

I hope the answers for 2 questions (if possible..)

See ya

Les Pinter
Les Pinter
StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)
Group: Forum Members
Posts: 43, Visits: 213
Oi Luiz,



Good guess, but StrataFrame evolved not from Clarion, but from FoxPro, which had so many data handling features built in that it made .NET look a little weak. Luckily, Trent decided to fix what was wrong with it, and StrataFrame is the result.



Les
Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Greg, tks a lot!!!

It was really fantastic, my problem is solved!BigGrin
I´ve implemented some Business Rules events and my fields works automatically.

Trent, some comments:

- I think the SF documentation would have more details about Advanced things, to solve my problem I read the "Dynamic Business Object Events" chapter from help, and with Greg explanations I´ve got it! I´m a SF BeginnerWink.
- Worth doing the SF training for advanced stuffs? (Remeber that I´m not a advanced VB developer).
- Congratulations for SF development, until now I didn´t see nothing like that (I´ve tested a lot of RAD Tools).
- You and your team came from Softvelocity Clarion? Because SF it´s very close of Clarion concepts.

See ya guys!

 

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Thanks for the sample, Greg.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
If you are saving it into the table, then the Compute method might not be the way to go. That is the way to go if you are going to calculate it when you need it.



If you are saving it to the table, then no custom property needed. It will be added when you map the BO (since there should be a column in the table to hold it). Thus, the saving, retrieving of the value from the table is taken care just like any other column in the table, via the BO.



However, the source of the data is different. Instead of a user filling it in, you need to manage the value of the parent total column, pec_valtotal_item, based on edits to the child items, from the itc_total_mercadorias field. I'm sure there are lots of ways to do this, but here are a few to start (these assume you want to persist the total to the table, as you indicated):



- in the child BO, handle some key events and keep the parent record updated.

- During the process of saving the child BO, call a sproc to keep parent updated.



The issue with the first is that you'd then have to code the UI to keep it fresh. I've worked up a sample that implements the first solution. It uses the StrataFrameSample database. Run the sql script in the SQL folder to update the Orders table to include a total column and initialize it with the correct data.



This sample uses BO property events (Changing and Changed) along with the handling BeforeUndo and AfterUndo events. The basic concept is that the child BO () updates its parent during edits, via these events.



Hope this helps!
Attachments
ChildUpdateParentExample.zip (155 views, 212.00 KB)
Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Trent and Greg,

Tks a lot, but I still have doubts... i´m starter (don´t forget! Smile)

My Parent is: boPedidoCompra1, field to be summarized: pec_valtotal_item (it should be saved into table)
My Child is: boPedidoCompraItens1, total field: itc_total_mercadorias

How will I create a property on Parent boPedidoCompra1 if the pec_valtotal already already exist?
The code would be like below on boPedidoCompra1?

boPedidoCompraItens1.CurrentDataTable.Compute("Sum(itc_total_mercadorias)","");

 (and... where I put it in my code below generated by BOM?)

''' <summary>
''' Valor Total dos Itens
''' </summary>
''' <remarks></remarks>
<Browsable(False), _
BusinessFieldDisplayInEditor(), _
Description(
"Valor Total dos Itens"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Property [pec_valtotal_item]() As System.Decimal
    Get
        Dim loValue As Object
         loValue = Me.CurrentRow.Item("pec_valtotal_item")
         If loValue Is DBNull.Value Then
            Return Nothing
         Else
           Return CType(loValue, System.Decimal)
         End If
     End Get
     Set(ByVal value As System.Decimal)
        Me.CurrentRow.Item("pec_valtotal_item") = value
    End Set
End Property


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
No problem Smile Glad it came in handy!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search