How to compare 2 table cell values are matching or not ?
NimbleBug
Member Posts: 483
Hi,
I have 2 tables ,
TableA with 100 rows and 1 column (with random cell values)
TableB with 100 rows and 80 Columns(with random cell values)
how can i compare TableA 100 rows and 1 column (cell values) equal to TableB 100 rows 1 column(cell values) "out of 80 Columns in Table B"
Thanks
Comments
Use tableMergeValues to store all of the values from one column in a single text attribute. Do that for both tables and then compare the two text attributes. I'm not at my computer but if you need a demo I can make one later.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Thank u for quick reply
tableMergeValues(table,"[row|col]",targetRowCol,startRange,endRange,separator)
This syntax is completely new for me can u make demo (when ever u can ) or suggest me any video tutorial so that i can try .
And my table values are 0 or 1 (integer)
I think @Braydon_SFX has a tutorial video. I can make you a demo tonight.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Here's the demo: http://forums.gamesalad.com/discussion/comment/451279/#Comment_451279
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Yep. Search for that function on youtube or on the gshelper youtube page. That should bring up a video tutorial.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
And actually, if you're using numerical values it's much simpler to use a tableColSum() function. Here's a demo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank You so much from the demo,in this file we are comparing columns from the same table , but it my case i want to compare columns from the other table(Compare TableA 100 rows and 1 column (cell values) equal to TableB 100 rows 1 column(cell values) "out of 80 Columns in Table B")
Yes, you just need to substitute the table attribute for the second table in one of the Change Attribute behaviors.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Demo:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Thank u for the demo ,instead of calculating sum of all row in a column,is there a way to compare each cell individually ,because in my case some times sum is equal but cell values are different
from ur demo file i changed Table A 1 0 1 0 0
table B values 0 1 01 0
Both totals are same so it is showing A=B
but actually totals are equal not Tables
Here's a modified version of tatiang's demo that's comparing texts instead of sums:
https://www.dropbox.com/s/lqhz9t4tclzbrdg/tableMergeValues.zip?dl=1
@tatiang @Manto Thank u so much for very fast help..it solved my problem ,Awesome Gamesalad Forums
Oh wow... it must have been late at night when I suggested comparing the sum of the tables. Obviously, that's not a good indicator! Sorry about that.
Thanks to @Manto for coming to the rescue.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Hey no problem ...i learnt new things about tables
I have one Question
tableMergeValues( game.|T| A ,"col",1,1,tableRowCount( game.|T| A ),"|")
in this what is that "col"
and you created self attribute column1,column2 but not used any where
can u please elaborate a bit .
Thanks
"col" means we are merging the values of a column (that's the rows of the column). It would be "row" if we were merging values of a row. The number after either "col" or "row" defines which column's or row's values are merged.
I didn't see the column1 or column2 attributes used anywhere, they are probably not there on purpose.
@manto Thank you for the explanation