How to display results in a table with self-defined categories

29 views
Skip to first unread message

Jakob

unread,
Mar 28, 2025, 11:44:36 AM3/28/25
to classEx - Help and Discussion Forum

Hey everyone,

I want to display the results of my game in a table, similar to the one in the picture, but I'm not sure how to get started. Could anyone help me out?
There is only one variable "value" which can range from 180 to 300.

Screenshot 2025-03-28 163647.png
Thanks for your support!

Marcus Giamattei (classEx Team)

unread,
Mar 28, 2025, 3:25:39 PM3/28/25
to classEx - Help and Discussion Forum
Hej Jakob, thanks for your question.

What you need to do is to add a global program in the result stage of the game.
Then you can use the functions to retrieve frequencies (see https://classex-doc.readthedocs.io/en/latest/Programming.html#functions    )
And display them as a table in a textbox with HTML and the retrieved values.

Best, Marcus

P.S. Here is some code that I used for my table after retrieving the values:

<table class="table"><tbody><tr><td></td><td colspan="2" style="text-align: center;">No Delegation</td><td colspan="4" style="text-align: center;">Delegation</td></tr><tr><td style="text-align: center;">Role</td><td style="text-align: center;">A unfair</td><td style="text-align: center;">A fair</td><td style="text-align: center;">A unfair</td><td style="text-align: center;">A fair</td><td style="text-align: center;">B unfair</td><td style="text-align: center;">B fair</td></tr><tr><td style="text-align: center;">A</td><td style="text-align: center;">$gA11[A];</td><td style="text-align: center;">$gA12[A];</td><td style="text-align: center;">$gA21[A];</td><td style="text-align: center;">$gA22[A];</td><td style="text-align: center;">$gA211[A];</td><td style="text-align: center;">$gA212[A];</td></tr><tr><td style="text-align: center;">B</td><td style="text-align: center;">$gA11[B];</td><td style="text-align: center;">$gA12[B];</td><td style="text-align: center;">$gA21[B];</td><td style="text-align: center;">$gA22[B];</td><td style="text-align: center;">$gA211[B];</td><td style="text-align: center;">$gA212[B];</td></tr><tr><td style="text-align: center;">C</td><td style="text-align: center;">$gA11[C];</td><td style="text-align: center;">$gA12[C];</td><td style="text-align: center;">$gA21[C];</td><td style="text-align: center;">$gA22[C];</td><td style="text-align: center;">$gA211[C];</td><td style="text-align: center;">$gA212[C];</td></tr></tbody></table>

Jakob

unread,
Mar 31, 2025, 3:16:04 PM3/31/25
to classEx - Help and Discussion Forum

Hello Marcus,

Thank you for your quick response.

I was able to create the table; however, the values do not appear. I think the issue might be that the stages are not syncing the variables because it says the variable is undefined. Do you have any further advice?

Thanks a lot!
Best, Jakob

Marcus Giamattei (classEx Team)

unread,
Apr 1, 2025, 10:45:17 AM4/1/25
to classEx - Help and Discussion Forum
Hej Jakob,

keep in mind, that the global program is executed before the subjects program is executed. So you can only retrieve values that have been written by participants on previous stages.

Best, Marcus
Reply all
Reply to author
Forward
0 new messages