<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>uid
isPredicate
predicate_property_dict</params>
<dtml-let predicate_list="[]">
  <dtml-in prefix="loop" expr="_.range(_.len(uid))">
    <dtml-if "isPredicate[loop_item]">
      <dtml-call expr="predicate_list.append(loop_item)">
    </dtml-if>
  </dtml-in>
  <dtml-if expr="_.len(predicate_list) > 0">
REPLACE INTO predicate VALUES 
    <dtml-in prefix="loop" expr="predicate_list">
      <dtml-if sequence-start><dtml-else>,</dtml-if>
( 
  <dtml-sqlvar expr="uid[loop_item]" type="int">,
  <dtml-sqlvar expr="predicate_property_dict[loop_item].get('quantity', None)" type="float" optional>,
  <dtml-sqlvar expr="predicate_property_dict[loop_item].get('quantity_range_min', None)" type="float" optional>,
  <dtml-sqlvar expr="predicate_property_dict[loop_item].get('quantity_range_max', None)" type="float" optional>,
  <dtml-sqlvar expr="predicate_property_dict[loop_item].get('start_date', None)" type="datetime" optional>,
  <dtml-sqlvar expr="predicate_property_dict[loop_item].get('start_date_range_min', None)" type="datetime" optional>,
  <dtml-sqlvar expr="predicate_property_dict[loop_item].get('start_date_range_max', None)" type="datetime" optional>
)
    </dtml-in>
  </dtml-if>
</dtml-let>
