list the results of user.psoRelationships.findAllParentIds(...) in a child table

I have a database publishing template.

I want to list the results of user.psoRelationships.findAllParentIds(…) in a child table.

The only thing is, that returns GUIDs and I want to store the content id only.

There is a function $rx.guid.getContentId(guid) but I can’t run this on the collection of ParentIds.

Here is my binding:

Can you help me out please?

#Fri Sep 18 12:21:28 BST 2009
00.name=$db.action
00.value=“r”
01.name=$db.origin
01.value=“dbo”
02.name=$db.resource
02.value=“jdbc/MyDB”
03.name=$db.drivertype
03.value=“jtds:sqlserver”
04.name=$db.database
04.value=“MyDB”
05.name=$db.parent
05.value=“tblRestriction”
06.name=$this_id
06.value=$sys.item.getProperty(‘rx:sys_contentid’)
07.name=$row.RestrictionID
07.value=$sys.item.getProperty(‘rx:sys_contentid’)
08.name=$row.RestrictionType
08.value=$sys.item.getProperty(‘rx:restrict_condition’)
09.name=$row.RestrictionValue
09.value=$sys.item.getProperty(‘rx:restrict_value’)
10.name=$child[0].RestrictionID
10.value=$sys.item.getProperty(‘rx:sys_contentid’)
11.name=$parentguids
11.value=$user.psoRelationships.findAllParentIds($sys.item.UUID,“ppStRestrictedContent”)
12.name=$db.child[0]
12.value=“tblRestrictedContent”
13.name=$child[0].ContentID
13.value=$parentguids
clipboard.id=com.percussion.services.assembly.data.PSTemplateBinding.BINDINGS

Many thanks.

After more digging,

findAllParentIds returns a Set<com.percussion.design.objectstore.PSLocator>

C:\Rhythmyx\PSOToolkit6.6\PSOToolkit6.6\javadoc\com\percussion\pso\relationships\IPSOParentFinder.html

PSLocator.getId() returns the content id but is not accessible to the toolkit

C:\Rhythmyx\Docs\Rhythmyx\Javadocs\com\percussion\design\objectstore\PSLocator.html

Solved:

Couldn’t figure out how to create an empty list so had to do create one using the first item, then skip the first item in the foreach:

$i=0;
$id = $rx.guid.getContentId($parentguids[0]);
$mylist = $user.psoListTools.asList($id);

foreach($p in $parentguids) {
	if($i>0) {
		$id = $rx.guid.getContentId($p);
		$mylist.add($id);
	}
	$i = $i + 1;
}

then

$child[0].ContentID = $mylist

You can create an empty list with the PSOListTool.asList() method. Just specify a list length of 0.

Brilliant! Thanks.

$parentids = $user.psoListTools.asList("",0);

foreach($p in $parentguids) {
	$id = $rx.guid.getContentId($p);
	$parentids.add($id);
}