I am trying to display data from a single data source however I want to differentiate the results between two columns.
The scenario, I have a game object, each game consists of 2 players. Each player will take a turn and record the score. The Turn is its own data structure that records what game it belongs to, which player had the turn, what turn number it was, and what the score was.
I want my table to Display each turns score in a vertical table as they are recorded. e.g.
So players 1 scores are recorded on the left and player 2 scores on the right.
If i set the table data source to the turn data structure (and filter for the current game) it will return all the results for both player 1 and player 2.
How do I set column A to only show player 1 scores (in order) and set column B to only show player 2 scores.
When I try to do this the results are staggered (i think because i filter the results list to payer and the row’s index.
So each turn has a score for both players before moving to the next turn.
Each player can score in different orders so it is not always Player 1 then player 2.
Any help on sorting out this table display would be appreciated.
In your RepeatingGroup, Sort the results Ascendingly by the “TurnNo” then in the “Conditionals” tab of your RepeatingGroup each cell’s item, Add a condition to check whether the “TurnNo” is Even or Odd “i.e. TurnNo % 2 is 0”. Based on the result choose to display which record for which player.
If you would like to give me access to your application, I might be able to configure it for you.
Hope this helps !
I have created a dummy app with this problem and should be accessible here.
In this you can see that when I search for the all the Turns that belong to the Game
The results are staggered.
The table datasource picks up 10 items in its search and therefore wants to create 10 rows. Even though I want these split across 2 columns of 5 rows each.
Having the above setup, I assume the following:
1 - Each Turn in the game has 2 records in the table “Turn”, 1 row for player 1 and 1 row for player 2 , right ?
2 - I assume you have a RepeatingGroup where you display all the turns of a specific game. Under this RepeatingGroup, I guess you have another Group with its data source set to “Current Cell’s Turn”, Right ?
3 - If both of the above points are correct, Then in the “Text” element of Row 1 Column A , You should display “Current Cell’s Score” when the player name is “Joe”. While in the “Text” element of Row 1 Column B , You should display “Current Cell’s Score” when the player name is “jane”.
I am using the inbuilt Table element which contains a repeating group in cell 1A, 1B, etc.
The text element of the repeating group refers to the “Current Cell’s Turn”
This is what I am doing…the only way to filter on the name is in the conditional formatting. However since the table Turn records the first record for player Jane as the second row of its data, this only appears in the second row in my display, hence why they are staggered.
I have come up with a solution now.
I added another data layer called TurnGroup between Game and Turns
A Game consists of multiple Turn Groups, each Turn Group has a TurnNo and a link to PlayerOne’s Turn and PlayerTwo’s Turn.
This approach works though I am not sure if it is the best approach.
I will leave this post open a while longer in case anyone has other idea’s but for now I can keep progressing with something functional.