Hello,

I'm trying to create the following JSON structure for return from a web 
service call:

"players" : [
    {
"playerId" : "123",
    "playerName" : "JD Martinez",
"playerCurrentTeam" : "Boston Redsox",
"teamId" : "1000",
"playerFormerTeams" : [
    "Diamondbacks",
"Tigers",
"Astros"
]
},
    {
"playerId" : "456",
    "playerName" : "Chris Sale",
"playerCurrentTeam" : "Boston Redsox",
"teamId" : "1000",
"playerFormerTeams" : [
    "Whitesox",
"Dodgers"
]
}
]

I'm being given access to two SPIN templates to call:
1. returns all current players for a team whose value is passed in as a 
parameter.
2. returns all former teams for player whose value is a result of the id in 
the first template (1000 in the case above).

@prefix former_team: <http://metadata.mlb.org/teams/team_data#> .

                    <swon:Value arg:name=\"players\">
    <swon:Array>
<swon:Object>
<ui:call arg:team_id=\"{= ?team_id }\" ui:template=\"{= 
int-spin:PlayersByTeamIdTemplate }\" ui:varName=\"rs\">
<ui:forEach ui:bindVars="?playerId,?playerName,?playerCurrentTeam,?teamId" 
ui:resultSet="{= ?rs }">
<swon:Value arg:name="playerId" arg:value="{= ?playerId }" />
<swon:Value arg:name="playerName" arg:value="{= ?playerName }" />
<swon:Value arg:name="playerCurrentTeam" arg:value="{= ?playerCurrentTeam 
}" />
<swon:Value arg:name="teamId" arg:value="{= ?teamId }" />
<swon:Value arg:name=\"playerFormerTeams\">
<ui:call arg:pft=\"{= former_team:1000 }\" ui:template=\"{= 
int-spin:FormerTeamsByIdTemplate }\" ui:varName=\"pft_rs\">
<swon:RSArray arg:resultSet=\"{= ?pft_rs }\"/>
</ui:call>
</swon:Value>
</ui:forEach>
</ui:call>
</swon:Object>
</swon:Array>
                    </swon:Value>
How do I pass in the teamId result from the first query 
(PlayersByTeamIdTemplate) to the second query (FormerTeamsByIdTemplate)?
In the example above I've hard-coded it (former_team:1000 to prove it works 
and it does (there is a prefix for "former_team").

I've tried things like arg:pft=\"{= former_team:?teamId }\" but that 
doesn't work.

Thanks...

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/7c9c4aa2-b8c4-442f-8782-7c9cb216b77f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to