Combine data from 50 database rows?
awhedbee
Lakeland, FlMember, PRO Posts: 5
Hello,
I have a question. I'm still pretty new to gamesalad and wondering the easiest way to combine the values from 50 database rows. Basically each level saves the highscore to the row (which is the level number) and then column 5.
So I need to combine the score from "Column 5" from "Rows 1-50" and then display it as "Bits Recovered"
"Bits Recovered: "..tableCellvalue((game.Table 1), 1 , 5)
It will display row 1 column 5 but I cannot get it to add them all together. I am trying to find more documentation on the "tablecellmerge"
Thank you for any help!
Comments
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Awesome thank you so much
I've got it merging now is there a way to add them all together easily?
Oh sorry, I forgot that you needed to sum them. The only way to do that is with a Loop (or Loop over Table if PC Creator has that behavior):
Loop while self.rowIndex < tableRowCount(tableName)
Change Attribute self.rowIndex to self.rowIndex+1
Change Attribute self.sum to self.sum+tableCellValue(tableName,self.rowIndex,5)
If self.rowIndex = tableRowCount(tableName)
[Loop has completed]
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Awesome Thank you
Seems like tableColSum would sum them for you without the overhead of an external loop and extra complicated syntax.
Even better.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User