Buy Now
Sign in

My biggest challenge so far. How can I calculate match results?

dhuizinga1 , April 23 at 18:23
D
dhuizinga1
Hello all,​
​​
​After a long time trying everything and looking at examples and of course with the help and attention of some of you has managed to generate a number of lists. Lists that are all flat and do not do calculations. It is a list of sports clubs and it is a list of teams that belong to that sports club and it is a list of competitions.​
​​
​But now I come to a point where I need the experts :-)​
​What I would like is that a calculation is made on the list of matches played.​
​In total there are four games played:​
​1 men double, 1 ladies double and 2 mix double. For each winning match, a team gets one point.​
​The result can thus for example become 3-2 or 2-4 but can also be the same. So 2-2.​
​​
​Like I said. I now only have flat lists. I do not know how to proceed in order to realize the above.​
​I think it is useful to store the result in the database, but in the end a winner has to be determined based on the most obtained points.​
​​
​To realize this will be a challenge for me. I hope someone can explain to me what I need to do step by step in order to arrange it. I also do not know what people already need to start.​
​​
​My English is not my strongest side either, so I try to formulate my question as well as possible. But it may be that I do not explain properly. In that case I hope you ask again.​
​​
​I, and a number of sports clubs would be grateful and thank you very much for thinking along, and hopefully a contribution to the result.​
​​
​Sincerely​
​Dirk
live your dream, do not dream your life
GreyHead
Hi Dirk,
What data have you save that can be used in these calculations? What are the table and column names?
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
D
dhuizinga1
Hi Bob,​
​​
​I have a database table that has the name 'swc_chronoforms_data_schema'.​
​This table has the following columns:


​--------------------------​
​aid​
​user_id​
​created​
​modified

speedatum ​
​aanvangstijd​
​team_a​
​team_b​
​poule

team_a_hd1​
​team_b_hd1​
​team_a_dd1​
​team_b_dd1​
​team_a_mix1-1​
​team_b_mix1-1​
​team_a_mix2-1​
​team_b_mix2-1

team_a_hd2​
​team_b_hd2​
​team_a_dd2​
​team_b_dd2​
​team_a_mix1-2​
​team_b_mix1-2​
​team_a_mix2-2​
​team_b_mix2-2

team_a_hd3​
​team_b_hd3​
​team_a_dd3​
​team_b_dd3​
​team_a_mix1-3​
​team_b_mix1-3​
​team_a_mix2-3​
​team_b_mix2-3​
​---------------------------​
​​
The set positions are stored in the team_ * columns. This principle already works. Now with these set stands you have to count. As an example team_a_hd *. This is men's double match. There will be played for two won sets, but with tie sets a tie-break must be played. From that match it must be decided who the winner is and who gets 1 point for the won match. The loser gets no points.​
​​
​The same applies to team_a_dd *, team_a_mix1 * and for team_a_mix2 *.​
​​
​When it is known how the match points are divided, for example 1-3, 4-0 or 2-2, these match points must be stored in the databases. I have not yet included columns for this in the table.​
​​
​After having played a number of matches, it is possible to determine who is the group winner on the basis of these match points.​
​​
​This is roughly what I need​
​​

some extra info:​
​Function name is 'read_wedstrijd'​
​Event name is 'wedstrijd'​
​form name = 'wedstrijd_form' that calls event save and data provider {var:read_wedstrijd}​
​​
​Thanks for contributing ideas.
live your dream, do not dream your life
D
dhuizinga1
Hello dear people,​
​​
​I know that I ask a lot. Sorry for that. But I'm not a programmer :-).​
​As you can read, I have already come a long way in what I need to keep track of scores and classes for various tennis clubs. Only the last piece will absolutely not work without your help. This last piece is essential to make it work. More than a week after posting, unfortunately only one response has been received after that, nothing more.​
​It will not all be as simple as I think and maybe I'm too naive or something.​
​But I really hope that there is someone who wants to help me with this.​
​Would really like that. What I need exactly can be read above. If you need more information please contact me.​
​​
​Sincerely​
​Dirk
live your dream, do not dream your life
H
healyhatman
You're asking far too much. And you shouldn't be storing all of that in the one table it's a nightmare for maintenance. At this point based on your skillset you either need to delay it while you learn a bit more about databases, or pay someone.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
D
dhuizinga1
Hello healyhatman,​
​​
​Thanks for your reply.​
​I also do not store everything on one table. The table mentioned is where the results played are recorded. I understand that it is quite a big job. My skills are not very high on dbases, I know. But still it would be nice. Of course I would like to learn more about this .. but when I search for the forum I mainly see reactions that are about older version CC. That does not make things any easier ... and I can not find anything at all about how I should count with CCv6. That is a difficult process.​
​If it is a reasonable compensation, you also want to pay well for the job. That's no problem. But rather not huge amounts .. we are actually a no-budget club.​
​​
​With kind regards,​
​Dirk
live your dream, do not dream your life
H
healyhatman
With your read data action, you can add things up by doing
SUM(Model.field):model.alias
in fields to retrieve.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
D
dhuizinga1
Thnx again...
but how to display this on screen. I expect to do this in Events?
and does this work? SUM(Model.field):model.alias + SUM(Model.field):model.alias to dispay the sum of two fields?
Im still trying to experiment..
live your dream, do not dream your life
D
dhuizinga1
Unfortunately, I'm still struggling with this and I can not figure it out with only healyhatman's answer. Unfortunately, only the SUM (Model.field): model.alias info is not enough for me. Have searched in all kinds of forums but unfortunately can not make the link. I have also seen in the forum that more people are looking for this solution. Can someone explain a little more about how SUM works in CC. I do not think there are any tutorials here either. I am now stuck and development is halted.​
​​
​Who can and wants to help me with this?​
​​
​with kind regards​
​Dirk Huizinga​
​​
​ps. A word of thanks to everyone who helped me.
live your dream, do not dream your life
D
dhuizinga1
Hello all,​
​​
​Apparently this is impossible or it is a super complex story. I can not get out and hardly anyone has responded. Problem is, however, that I have to continue with development because after the summer we would like to work with this. Because I have a lot more other things to do with the website, I want to leave it at this. We will go back to Excel. Its a shame, but there is nothing to do about it. That's just the way it is.​
​So I will do the calculations manually. I know it is prone to error.​
​Forget about this topic. Apparently SUM can not be made from a table.​
​Topic may be closed.
PROBLEM NOT SOLVED :-)​
​​
​Sincerely​
​Dirk
live your dream, do not dream your life
H
healyhatman
EDIT: Remove the SUM bit
It's not CC you need to know for this one it's SQL.​
​​
​Try
(Model.field1 + Model.field2 + Model.field3):Model.alias
Make sure you keep the spaces between the fields and the + symbol.
So for me, I used this:
Fields to retrieve:
​timesheet.user_id​
​timesheet.total_hours​
​(timesheet.user_id + timesheet.total_hours):timesheet.SUMOFBOTH
And got this:
Array
(
[0] => Array
(
[timesheet] => Array
(
[user_id] => 10
[total_hours] => 8.00
[SUMOFBOTH] => 18.00
)

)

[1] => Array
(
[timesheet] => Array
(
[user_id] => 10
[total_hours] => 8.00
[SUMOFBOTH] => 18.00
)

)

[2] => Array
(
[timesheet] => Array
(
[user_id] => 10
[total_hours] => 7.33
[SUMOFBOTH] => 17.33
)

)
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
GreyHead
Hi Dirk,
As Healyhatman says, you are asking a bit much here. You may need to get help from someone with experience in working with database tables to design the setup and logic you will use. We can then help you implement that in CF+CC.
The MySQL SUM() function is used to get the total from a single column which is not what you need. In a MySQL query you can use e.g. SELECT (col_a + col_b) as score from table_name. See here for an example.
But I suspect that you need more work on the table structure to get that to work smoothly.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
H
healyhatman
I sorted it out Bob, as above.
(Model.field1 + Model.field2):Model.alias
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
D
dhuizinga1
Hi Bob and healyhatman,​
​​
​First of all, thanks for your response and also for your patience. I am aware of the fact that it was not a simple question, but I had hoped that some help and examples would come out of it. This of course did not need to be free. I would have liked to pay a fee here. Because of the help I have received so far, I have bought both CF and CC. As support for the good work.​
​​
​With all the ins and outs, it did not work with your additions. I did not even succeed in making an addition of a single column.​
​​
​Yet I greatly value your commitment and drive. But this is not going to be for me. This is beyond my cap. As I have already indicated, I will keep everything but Excel. Unfortunately it is no different. In the meantime I hope that there will be good instuctions and tutorials for v6. Because unfortunately they are still missing.​
​​
​Guys, keep up the good work and I will only use it for simple flat lists. I have to leave arithmetic to others who can. :-)​
​​
​With kind regards​
​Dirk
live your dream, do not dream your life
H
healyhatman
It should work. Please paste what you have in fields to retrieve
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman