TRIRIGA

 View Only

 Question about how to make query section that shows only records of specific field value

HIROYA OGIHARA's profile image
HIROYA OGIHARA posted Wed August 06, 2025 10:06 AM
Rishabh Agarwal's profile image
Rishabh Agarwal

This is the feature of Query Section. You can retrieve and show the Players information inside Query Section which are belongs to Selected Team (on BaseballTeam Form). Just you need the Association String to show the associated players with the Team. Also here you can filter out the Player records based on Status of Players.

Mark Johnson's profile image
Mark Johnson IBM Champion

You should use an association between the BaseballTeam and the Baseball Player like "Has Player" and "Is Player For" for your forward and reverse association strings. 

What you want to do is build an advanced query on the BaseballPlayer BO. On the advanced tab you want to use the  $$RECORDID$$ and then you would set the information to the BaseballTeam BO and its association string to Baseball Player ("Has Player").  On the advanced tab you always go from what you know to what you want. Since the query section will be on the BaseballTeam form, that is what you know and what you want is the players. That's why the information you put in to the advance tab is for the BaseballTeam. You then put your query section on the BaseballTeam form. 

Unrelated to your question, in your example you use cstBaseballTeamidTX, and also cstBaseballTeamid2TX. I'd recommend against putting numbers in to your field names as it makes it harder to identify those fields in the T Table. Also, Field names are unique and you create them just once. You then can reuse that name on other objects, so you wouldn't need a separate field with the number 2 in it. You'd just find the field from the BaseballTeam with name that you want to reuse.

Hope that helps,

Mark

HIROYA OGIHARA's profile image
HIROYA OGIHARA

@Mark Johnson

Thank you so much.
 
We tried to use the associations you recommended. However still we don't get the player list we expects (Only players belonging to the team listed).
We added "Has Player" and "Is Player For" associations to the AssiociationTypes list of System and use them.
We created the following BOs:
Module:
     cstBaseballTeam
BO1:
     cstBaseballTeam (Parent)    Fields: cstBaseBallTeamidTX(Object Mapping Field),  cstBaseballTeamNameTX
BO2:
    cstBaseballPlayer    Fields: cstBaseballTeamidTX(We use cstBaseballTeamidTX instead of cstBaseballTeamid2TX as you recommended), cstPlayerNameTX, cstPlayerAgeNU
 
 
I posted the following screen captures related to association settings. I'd appreciate it if you check our settings are correct?
- Association of cstBaseballTeam 
Association Settings of cstBaseballTeam
- Association of cstBaseballPlayer
Association Settings of cstBaseballPlayer
- QuerySection of cstBaseballTeam form
QuerySection settings on cstBaseballTeam form
- Association Filter of Advanced tab ("Query - cstBaseballPlayer" that is used in the QuerySection)
Association Filter setting of cstBaseballPlayer query
Mark Johnson's profile image
Mark Johnson IBM Champion

One piece that we haven't discussed is that you need to associate the records before they would show up in the query section. What is the purpose of your query section, just to show the players on the team, or to be able to find players and add them to the team? So far what I shared with you would show the players associated to the team. If you want to add players, you'd want to create another query that just lists players, and then add that to the find action, and also have it call a workflow. In the workflow you would get the player, you'd want to find if they are already associated to another team, if so remove the association, and then associate the player to the new team. Then they would show up in your query.

There is another advanced query that you could do where on the system filter you'd use a parent filter on the cstBaseballTeamIdTX on the player record that points to the cstBaseballTeamIdTX field on the baseball team record. Look up the $$PARENT filter in the report manual to see the format and how it works.

One thing you'll find about TRIRIGA development, is there are usually multiple ways to do things. However, getting the right result is just one part of it as all ways are not created equal.