How to compare 2 table cell values are matching or not ?

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    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.

  • NimbleBugNimbleBug Member Posts: 483
    edited March 2015

    @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)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I think @Braydon_SFX has a tutorial video. I can make you a demo tonight.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Yep. Search for that function on youtube or on the gshelper youtube page. That should bring up a video tutorial.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    And actually, if you're using numerical values it's much simpler to use a tableColSum() function. Here's a demo.

  • NimbleBugNimbleBug Member Posts: 483

    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")

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    Yes, you just need to substitute the table attribute for the second table in one of the Change Attribute behaviors.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Demo:

  • NimbleBugNimbleBug Member Posts: 483

    @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

  • NimbleBugNimbleBug Member Posts: 483

    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

  • MantoManto Member Posts: 796

    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

  • NimbleBugNimbleBug Member Posts: 483

    @tatiang @Manto Thank u so much for very fast help..it solved my problem ,Awesome Gamesalad Forums :)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    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. :)

  • NimbleBugNimbleBug Member Posts: 483

    @tatiang Hey no problem ...i learnt new things about tables :)

  • NimbleBugNimbleBug Member Posts: 483

    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

  • MantoManto Member Posts: 796

    @NimbleBug said:
    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.

  • NimbleBugNimbleBug Member Posts: 483

    @manto Thank you for the explanation :)

Sign In or Register to comment.