Thanks, Holger.

I actually tried to simplify the real code but in doing so I realize I made 
it misleading.  The parameter for the outer ui:call is not teamId in the 
actual use case.  It's something that could return multiple teamIds, say 
something like jerseyColor.  Multiple teams could result but I'd be looking 
for the players and their former teams for multiple teams by the current 
teamId.  Does that make sense?

I hadn't noticed the inconsistently escaped double-quotes. They are like 
that in the real code too.  Seems like that would cause issues but it's 
(mostly) working as expected except for the parameter to the inner 
ui:call.  Worth noting that with my small sample set so far I'm only 
getting one "team" back so far so perhaps the quote issue would reveal 
itself once I expand my testing.

Should I be trying to ui:concat with formerTeam: and ?teamId   ?   I played 
around with that but could not get the syntax right.

Thank you, Adrian.

On Tuesday, July 16, 2019 at 5:21:39 PM UTC-6, Holger Knublauch wrote:
>
> Hi Adrian,
> On 17/07/2019 04:05, AdrianP wrote:
>
> 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#> 
> <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.
>
> Have you also tried arg:pft="{= ?teamId }"? If that doesn't work, could 
> you send us the definition of the int-spin:FormerTeamsByIdTemplate query so 
> that I can see what else could be mismatching?
>
> Looking at the snippet above I also do wonder why the " characters are 
> sometimes escaped with \ and sometimes not...
>
> Regards,
> Holger
>
>

-- 
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/f308799b-25a1-449c-9f11-564f1c2a8189%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to