Hi All,
Does anyone have recommendations on how to mass-insert records from a XML Hierarchy select?
Our goal is to automatically add “person_place - PORTAL_PLACE” records when a new place is created in FSM, based on the place’s global_name.
i.e. new place (PlaceA) is added for global_name (Spencer)
- hierarchy select retrieves all person_id’s for people that have Portal_Place entries for “Spencer”
- Mass-insert inserts a new person_place record for “PlaceA” for the people identified in the Hierarchy Select.
We tried with Mass_Update, which seems to be limited to “update” or “delete” only.. we can’t insert new entries
we tried with Perform_batch, but the insert portion only applies to the 1st result of the hierarchy select (multiple results, always just 1 insert)
sample of the perform batch:
<perform_batch>
<hierarchy_select result_name="ppinsert">
<primary_table>person_place</primary_table>
<from>person_place</from>
<attrs>
<attr>person_place.person_id</attr>
</attrs>
<where>
<data_constraint>
<constraint>
<left_operand>person_place.place_id</left_operand>
<operator>eq</operator>
<right_operand>@global_name</right_operand>
</constraint>
<constraint>
<left_operand>person_place.place_relationship</left_operand>
<operator>eq</operator>
<right_operand>PORTAL_PLACE</right_operand>
</constraint>
</data_constraint>
</where>
</hierarchy_select>
<update_person_place>
<person_place>
<person_id xpath_node="//person_place_hierarchy_select_result[@result_name='ppinsert']/person_place/person_id" />
<place_relationship>PORTAL_PLACE</place_relationship>
<place_id>@place_id</place_id>
<insert />
</person_place>
</update_person_place>
</perform_batch>
Any advice is appreciated.
Sincerely
-Rudy