Solved

Mass Update

  • 18 July 2022
  • 3 replies
  • 334 views

Userlevel 4
Badge +11

Hi all,

I created an xml message calling mass_update.  When I execute the message I get response saying number of records which were successfully updated, and no error.

The number of records based on select is correct number.

But when I check to the records, the fields are not updated. 

 

When I update a single record, the fields are updated.  So xpath_node is correct.

 

Do you know why this mass_update message doesn’t work?

 

Here is the xml message:

the xml message will update:

  • task.user_def_dttm5 := c_task_visit_tech_rev_view.visit_rev_start_work_dttm
  • task.user_def2 :=  c_task_visit_tech_rev_view.visit_rev_end_work
  • task.user_def_num1 := c_task_visit_tech_rev_view.visit_break_min

----------------------

<mass_update_task>
  <hierarchy_select result_name="select_result3">
    <primary_table>task</primary_table>
    <attrs>
      <attr>task.task_id</attr>
      <attr>c_task_visit_tech_rev_view.visit_rev_start_work_dttm</attr>
      <attr>c_task_visit_tech_rev_view.visit_rev_end_work</attr>
      <attr>c_task_visit_tech_rev_view.visit_break_min</attr>
    </attrs>
    <from>
      <table>task</table>
      <table>c_task_visit_tech_rev_view</table>
    </from>
    <where>
      <data_constraint>
        <constraint>
          <left_operand>c_task_visit_tech_rev_view.task_status</left_operand>
          <operator>eq</operator>
          <right_operand>IN PROCESS</right_operand>
        </constraint>
        <constraint>
          <left_operand>c_task_visit_tech_rev_view.visit_status</left_operand>
          <operator>eq</operator>
          <right_operand>COMPLETED</right_operand>
        </constraint>
        <constraint>
          <left_operand>task.user_def2</left_operand>
          <operator>null</operator>
          <right_operand>
          </right_operand>
        </constraint>
        <constraint>
          <left_operand>c_task_visit_tech_rev_view.visit_rev_start_work_dttm</left_operand>
          <operator>not_null</operator>
          <right_operand>
          </right_operand>
        </constraint>
        <constraint>
          <left_operand>c_task_visit_tech_rev_view.visit_rev_start_travel_dttm</left_operand>
          <operator>null</operator>
          <right_operand>
          </right_operand>
        </constraint>
      </data_constraint>
      <join_constraint>
        <constraint>
          <left_operand>task.task_id</left_operand>
          <operator>equi</operator>
          <right_operand>c_task_visit_tech_rev_view.task_id</right_operand>
        </constraint>
        <constraint>
          <left_operand>task.user_def3</left_operand>
          <operator>equi</operator>
          <right_operand>c_task_visit_tech_rev_view.visit_id</right_operand>
        </constraint>
      </join_constraint>
    </where>
  </hierarchy_select>
  <task>
    <task_id xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/task_id" />
    <user_def_dttm5 xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/c_task_visit_tech_rev_view/visit_rev_start_work_dttm" />
    <user_def2 xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/c_task_visit_tech_rev_view/visit_rev_end_work" />
    <user_def_num1 xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/c_task_visit_tech_rev_view/visit_break_min" />
    <update />
  </task>
  <transaction_size>100</transaction_size>
  <synchronous>Y</synchronous>
</mass_update_task>

 

 

 

icon

Best answer by Saranga Amaraweera 18 July 2022, 16:07

View original

3 replies

Userlevel 7
Badge +22

Hi @JuniSihombing ,

Is your hierarchy select returning multiple rows in the select? If it is returning only one item, then you might need to adjust your message within a perform_batch block as the xpath on a mass update message is referred only on separated hierarchy select result(s) or either by directly hardcoding the value to be updated. 

<perform_batch>
<hierarchy_select result_name="select_result3">
<primary_table>task</primary_table>
<attrs>
<attr>task.task_id</attr>
<attr>c_task_visit_tech_rev_view.visit_rev_start_work_dttm</attr>
<attr>c_task_visit_tech_rev_view.visit_rev_end_work</attr>
<attr>c_task_visit_tech_rev_view.visit_break_min</attr>
</attrs>
<from>
<table>task</table>
<table>c_task_visit_tech_rev_view</table>
</from>
<where>
<data_constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.task_status</left_operand>
<operator>eq</operator>
<right_operand>IN PROCESS</right_operand>
</constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.visit_status</left_operand>
<operator>eq</operator>
<right_operand>COMPLETED</right_operand>
</constraint>
<constraint>
<left_operand>task.user_def2</left_operand>
<operator>null</operator>
<right_operand>
</right_operand>
</constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.visit_rev_start_work_dttm</left_operand>
<operator>not_null</operator>
<right_operand>
</right_operand>
</constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.visit_rev_start_travel_dttm</left_operand>
<operator>null</operator>
<right_operand>
</right_operand>
</constraint>
</data_constraint>
<join_constraint>
<constraint>
<left_operand>task.task_id</left_operand>
<operator>equi</operator>
<right_operand>c_task_visit_tech_rev_view.task_id</right_operand>
</constraint>
<constraint>
<left_operand>task.user_def3</left_operand>
<operator>equi</operator>
<right_operand>c_task_visit_tech_rev_view.visit_id</right_operand>
</constraint>
</join_constraint>
</where>
</hierarchy_select>
<mass_update_task>
<hierarchy_select result_name="select_result">
<primary_table>task</primary_table>
<attrs>
<attr>task.task_id</attr>
</attrs>
<from>
<table>task</table>
<table>c_task_visit_tech_rev_view</table>
</from>
<where>
<data_constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.task_status</left_operand>
<operator>eq</operator>
<right_operand>IN PROCESS</right_operand>
</constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.visit_status</left_operand>
<operator>eq</operator>
<right_operand>COMPLETED</right_operand>
</constraint>
<constraint>
<left_operand>task.user_def2</left_operand>
<operator>null</operator>
<right_operand>
</right_operand>
</constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.visit_rev_start_work_dttm</left_operand>
<operator>not_null</operator>
<right_operand>
</right_operand>
</constraint>
<constraint>
<left_operand>c_task_visit_tech_rev_view.visit_rev_start_travel_dttm</left_operand>
<operator>null</operator>
<right_operand>
</right_operand>
</constraint>
</data_constraint>
<join_constraint>
<constraint>
<left_operand>task.task_id</left_operand>
<operator>equi</operator>
<right_operand>c_task_visit_tech_rev_view.task_id</right_operand>
</constraint>
<constraint>
<left_operand>task.user_def3</left_operand>
<operator>equi</operator>
<right_operand>c_task_visit_tech_rev_view.visit_id</right_operand>
</constraint>
</join_constraint>
</where>
</hierarchy_select>
<task>
<user_def_dttm5 xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/c_task_visit_tech_rev_view/visit_rev_start_work_dttm" />
<user_def2 xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/c_task_visit_tech_rev_view/visit_rev_end_work" />
<user_def_num1 xpath_node="//task_hierarchy_select_result[@result_name='select_result3']/task/c_task_visit_tech_rev_view/visit_break_min" />
<update />
</task>
<transaction_size>100</transaction_size>
<synchronous>Y</synchronous>
</mass_update_task>
</perform_batch>

You may refer a previous post related to the same topic below

 

Userlevel 4
Badge +11

hi @Saranga Amaraweera ,

 

yes.  the hierarchy select retuns multiple rows.

thanks for your answer.  I will try it.

 

Regarding the link, as I am not IFS employee nor partner, I am not able to see the post.

Could you please post the conversation here?

Thank you and best regards,

~Juni

Userlevel 4
Badge +11

@Saranga Amaraweera 

your solution works.

 

Thanks a lot!

~Juni

Reply