Yes, I was only testing the operation on 1.8 to understand if there are differences and if it was compatible.
On 1.7.16 I have a much more complex prepopulate that I attach to you.
Can you confirm that in your tests all modes work? For me only addIfEmpty work...
Thanks.
this is my prod prepopulate that work on 1.7.16
enabled = 1
prepopulate_fields_on_save = 1
prepopulate_fields_on_edit = 0
prepopulate_rules = {
#nuova regola per aggiornamento idno partendo object_id, antonio cassano 01/01/2019
idno_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.idno,
skipIfExpression = ca_objects.idno = ca_objects.object_id,
template = ca_objects.object_id
},
#fine regola per aggiornamento idno partendo object_id, antonio cassano 01/01/2019
#nuova regola per quantita calcolata, antonio cassano 08/07/2019
contapezzi_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.qnt_calcolata,
template = <case>
<ifdef code="ca_objects.qnt"><expression>int(ca_objects.qnt)</expression></ifdef>
<ifdef code="ca_objects.qntn"><expression>int(ca_objects.qntn)</expression></ifdef>
<ifdef code="ca_objects.qntn1"><expression>int(ca_objects.qntn1)</expression></ifdef>
</case>
},
#fine nuova regola per quantita calcolata, antonio cassano 08/07/2019
#nuova regola per quantita aggregata, antonio cassano 16/02/2021
tipo_parente_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.tipo_parente,
template = ca_objects.parent.type_id
},
contapezzi_agg_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.qnt_aggregata,
skipIfExpression = ca_objects.tipo_parente !~ /Cartella contenitore/,
template = <case>
<ifdef code="ca_objects.qnt"><expression>int(ca_objects.qnt)</expression></ifdef>
<ifdef code="ca_objects.qntn"><expression>int(ca_objects.qntn)</expression></ifdef>
<ifdef code="ca_objects.qntn1"><expression>int(ca_objects.qntn1)</expression></ifdef>
</case>
},
contapezzi_agg_rule_reset = {
table = ca_objects,
mode = overwrite,
target = ca_objects.qnt_aggregata,
skipIfExpression = ca_objects.tipo_parente =~ /Cartella contenitore/,
template = <expression>int(0)</expression>
},
#fine nuova regola per quantita calcolata, antonio cassano 16/02/2021
entity_diplayname = {
table = ca_entities,
mode = overwrite,
target = ^ca_entities.preferred_labels.displayname,
template = ^ca_entities.preferred_labels.surname<ifdef code="ca_entities.preferred_labels.forename">", "^ca_entities.preferred_labels.forename</ifdef>
},
# -------------------
entity_intest_person_rule = {
table = ca_entities,
restrictToTypes = [ind],
mode = overwrite,
target = ca_entities.intest_autor,
template = ca_entities.preferred_labels.prefix%trim
<ifdef code="ca_entities.preferred_labels.prefix">", "</ifdef>
ca_entities.preferred_labels.surname%trim
<ifdef code="ca_entities.preferred_labels.forename">", "</ifdef>
ca_entities.preferred_labels.forename%trim
<ifdef code="ca_entities.luogo_nascita|ca_entities.luogo_morte|ca_entities.data_esistenza_pers.data_nascita|ca_entities.data_esistenza_pers.data_morte"> \< </ifdef>
ca_entities.luogo_nascita%trim
<ifdef code="ca_entities.luogo_nascita,ca_entities.data_esistenza_pers.data_nascita">", "</ifdef>
ca_entities.data_esistenza_pers.data_nascita
<ifdef code="ca_entities.luogo_nascita|ca_entities.luogo_morte|ca_entities.data_esistenza_pers.data_nascita|ca_entities.data_esistenza_pers.data_morte">" - "</ifdef>
ca_entities.luogo_morte%trim
<ifdef code="ca_entities.luogo_morte,ca_entities.data_esistenza_pers.data_morte">", "</ifdef>
ca_entities.data_esistenza_pers.data_morte
<ifdef code="ca_entities.luogo_nascita|ca_entities.luogo_morte|ca_entities.data_esistenza_pers.data_nascita|ca_entities.data_esistenza_pers.data_morte"> \> </ifdef>
<ifnotdef code="ca_entities.luogo_nascita,ca_entities.luogo_morte,ca_entities.data_esistenza_pers.data_nascita,ca_entities.data_esistenza_pers.data_morte"><ifdef code="ca_entities.autg"> (ca_entities.autg%trim) </ifdef></ifnotdef>
<more><ifnotdef code="ca_entities.luogo_nascita,ca_entities.luogo_morte,ca_entities.data_esistenza_pers.data_nascita,ca_entities.data_esistenza_pers.data_morte,ca_entities.autg">", "</ifnotdef></more>
ca_entities.pseudonimo%trim
<ifdef code="ca_entities.autv">", "</ifdef>
ca_entities.autv%trim
<ifdef code="ca_entities.titolo_pers.specif_titolo|ca_entities.titolo_pers.titolo_pers1">", "</ifdef>
ca_entities.titolo_pers.titolo_pers1%trim
<ifdef code="ca_entities.titolo_pers.specif_titolo">" - "</ifdef>
ca_entities.titolo_pers.specif_titolo%trim
<ifdef code="ca_entities.titolo_pers.specif_titolo|ca_entities.titolo_pers.titolo_pers1,ca_entities.att_pro_qua.specif_professione_qua|ca_entities.att_pro_qua.att_pro_qua1">", "</ifdef>
ca_entities.att_pro_qua.att_pro_qua1
<ifdef code="ca_entities.att_pro_qua.specif_professione_qua">" - "</ifdef>
ca_entities.att_pro_qua.specif_professione_qua%trim
},
entity_intest_family_rule = {
table = ca_entities,
restrictToTypes = [fam],
mode = overwrite,
target = ca_entities.intest_autor,
template = ca_entities.preferred_labels.prefix%trim<ifdef code="ca_entities.preferred_labels.prefix">", "</ifdef>
ca_entities.preferred_labels.surname%trim
<ifdef code="ca_entities.preferred_labels.forename">", "</ifdef>ca_entities.preferred_labels.forename%trim
<ifdef code="ca_entities.pseudonimo">", "</ifdef>ca_entities.pseudonimo%trim
<ifdef code="ca_entities.autv">", "</ifdef>
ca_entities.autv%trim
<ifdef code="ca_entities.titolo_pers.specif_titolo|ca_entities.titolo_pers.titolo_pers1">", "</ifdef>
ca_entities.titolo_pers.titolo_pers1%trim
<ifdef code="ca_entities.titolo_pers.specif_titolo">" - "</ifdef>
ca_entities.titolo_pers.specif_titolo%trim
<ifdef code="ca_entities.titolo_pers.specif_titolo|ca_entities.titolo_pers.titolo_pers1,ca_entities.att_pro_qua.specif_professione_qua|ca_entities.att_pro_qua.att_pro_qua1">", "</ifdef>
ca_entities.att_pro_qua.att_pro_qua1
<ifdef code="ca_entities.att_pro_qua.specif_professione_qua">" - "</ifdef>
ca_entities.att_pro_qua.specif_professione_qua%trim
<ifdef code="ca_entities.autg"> (ca_entities.autg%trim)</ifdef>
},
entity_intest_ente_rule = {
table = ca_entities,
restrictToTypes = [org],
mode = overwrite,
mode = addIfEmpty,
target = ca_entities.intest_autor,
template = ca_entities.preferred_labels<ifdef code="ca_entities.preferred_labels.surname">, ca_entities.preferred_labels.surname%trim</ifdef>
<ifdef code="ca_entities.autv">, ca_entities.autv%trim</ifdef><ifdef code="ca_entities.tip_funz.specif_tip_funzionale"> - ca_entities.tip_funz.specif_tip_funzionale%trim</ifdef><ifdef code="ca_entities.autg"> (ca_entities.autg%trim)</ifdef>
# template = ^ca_entities.preferred_labels%trim<ifdef code="ca_entities.preferred_labels">", "</ifdef>
# ^ca_entities.preferred_labels.surname%trim
# <ifdef code="ca_entities.autv">", "</ifdef>
# ^ca_entities.autv%trim
# <ifdef code="ca_entities.tip_funz.specif_tip_funzionale">" - "</ifdef>
# ^ca_entities.tip_funz.specif_tip_funzionale%trim
# <ifdef code="ca_entities.autg"> (^ca_entities.autg%trim)</ifdef>
},
nuova regola per valorizzazione tipo_ambito, A Archivi, P patrimonio museale, C elementi contenitore es. scheda ente o Cartella contenitore
tipo_ambito_Archivi_rule = {
table = ca_objects,
restrictToTypes = [complesso_fondi,fondo,subfondo,super_fondo,livello,unita_ua,unita_doc],
mode = overwrite,
target = ca_objects.tipo_ambito,
skipIfExpression = ca_objects.tipo_ambito =~ /A/,
template = A
},
tipo_ambito_Patrimonio_rule = {
table = ca_objects,
restrictToTypes = [fototipo_ua,oggetto_ua,audiovideo_ua,stampe_ua,disegni_ua,fototipo_ud,stampe_ud,disegno_ud,oggetto_ud,audiovideo_ud,bdi_doc_audio,
bdi_doc_foto,bdi_doc_video,doc_integrativi,ai,vi,fi,matrice_ud,ff,arch_ua,oac_ua,pst_ua,fk_ua,mi_ua,beni_arch,folklore,oac,
pst,disegno,guizzi,numism,nu_aggreg,locale_sto,al34,me_mat_edit],
mode = overwrite,
target = ca_objects.tipo_ambito,
skipIfExpression = ca_objects.tipo_ambito =~ /P/,
template = P
},
tipo_ambito_Contenitore_rule = {
table = ca_objects,
restrictToTypes = [ente_aderente,cart_contenitore],
mode = overwrite,
skipIfExpression = ca_objects.tipo_ambito =~ /C/,
target = ca_objects.tipo_ambito,
template = C
},
fine
#valorizzazione automatica nctn e rvel
RVEL_auto_Patrimonio_rule = {
table = ca_objects,
restrictToTypes = [fototipo_ua,oggetto_ua,audiovideo_ua,stampe_ua,disegni_ua,fototipo_ud,stampe_ud,disegno_ud,oggetto_ud,audiovideo_ud,bdi_doc_audio, bdi_doc_foto,bdi_doc_video,doc_integrativi,ai,vi,fi,matrice_ud,ff,arch_ua,oac_ua,pst_ua,fk_ua,mi_ua,beni_arch,folklore,oac,pst,disegno,guizzi,numism,nu_aggreg,avp_cineteca,avf_cineteca,avv_cineteca,avc_cineteca],
mode = addifEmpty,
target = ca_objects.rve.rvel,
template = <expression>int(0)</expression>
},
NCTN_auto_Patrimonio_rule = {
table = ca_objects,
restrictToTypes = [fototipo_ua,oggetto_ua,audiovideo_ua,stampe_ua,disegni_ua,fototipo_ud,stampe_ud,disegno_ud,oggetto_ud,audiovideo_ud,bdi_doc_audio, bdi_doc_foto,bdi_doc_video,doc_integrativi,ai,vi,fi,matrice_ud,ff,arch_ua,oac_ua,pst_ua,fk_ua,mi_ua,beni_arch,folklore,oac,pst,disegno,guizzi,numism,nu_aggreg,avp_cineteca,avf_cineteca,avv_cineteca,avc_cineteca],
mode = addifEmpty,
target = ca_objects.nct.nctn,
template = NMca_objects.object_id
},
#NCTR_auto_Patrimonio_rule = {
table = ca_objects,
restrictToTypes = [fototipo_ua,oggetto_ua,audiovideo_ua,stampe_ua,disegni_ua,fototipo_ud,stampe_ud,disegno_ud,oggetto_ud,audiovideo_ud,bdi_doc_audio, bdi_doc_foto,bdi_doc_video,doc_integrativi,ai,vi,fi,matrice_ud,ff,arch_ua,oac_ua,pst_ua,fk_ua,mi_ua,beni_arch,folklore,oac,pst,disegno,guizzi,numism,nu_aggreg,avp_cineteca,avf_cineteca,avv_cineteca,avc_cineteca],
mode = overwrite,
target = ca_objects.nct.nctr,
#template = 01
},
#NCTS_auto_Patrimonio_rule = {
table = ca_objects,
restrictToTypes = [fototipo_ua,oggetto_ua,audiovideo_ua,stampe_ua,disegni_ua,fototipo_ud,stampe_ud,disegno_ud,oggetto_ud,audiovideo_ud,bdi_doc_audio, bdi_doc_foto,bdi_doc_video,doc_integrativi,ai,vi,fi,matrice_ud,ff,arch_ua,oac_ua,pst_ua,fk_ua,mi_ua,beni_arch,folklore,oac,pst,disegno,guizzi,numism,nu_aggreg,avp_cineteca,avf_cineteca,avv_cineteca,avc_cineteca],
mode = overwrite,
target = ca_objects.nct.ncts,
#template = 0
},
#nuova rgola per aggiornamento titolo dinamico, antonio cassano 21/02/2020
titolo_dinamico_Archivi_rule = {
table = ca_objects,
restrictToTypes = [complesso_fondi,fondo,subfondo,super_fondo,livello,unita_ua,unita_doc],
mode = overwrite,
target = ca_objects.titolo_dinamico,
template = <unit relativeTo="ca_objects" start="0" length="1">ca_objects.preferred_labels.name%truncate=63&%ellipsis=1<if rule=\"ca_object_labels.type_id !~ /-/\"> - ca_object_labels.type_id</if></unit><ifdef code="ca_objects.num_def_numero"> | Seg. Def.: ca_objects.num_def_numero</ifdef><ifnotdef code="ca_objects.num_def_numero"> <unit relativeTo="ca_objects.id_obj" start="0" length="1"><ifdef code="ca_objects.id_obj.num_provv_sigla|ca_objects.id_obj.num_provv"> | N. Prov.: ca_objects.id_obj.num_provv_sigla ca_objects.id_obj.num_provv</ifdef></unit></ifnotdef>},
titolo_dinamico_Patrimonio_rule = {
table = ca_objects,
restrictToTypes = [fototipo_ua,oggetto_ua,audiovideo_ua,stampe_ua,disegni_ua,fototipo_ud,stampe_ud,disegno_ud,oggetto_ud,audiovideo_ud,bdi_doc_audio,bdi_doc_foto,bdi_doc_video,doc_integrativi,ai,vi,fi,matrice_ud,ff,arch_ua,oac_ua,pst_ua,fk_ua,mi_ua,beni_arch,folklore,oac,pst,disegno,guizzi,numism,nu_aggreg,locale_sto,al34,me_mat_edit],
mode = overwrite,
target = ca_objects.titolo_dinamico,
template = <unit relativeTo="ca_objects" start="0" length="1">ca_objects.preferred_labels.name%truncate=63&%ellipsis=1<if rule=\"ca_object_labels.type_id !~ /-/\"> - ca_object_labels.type_id</if></unit><ifdef code="ca_objects.nct.nctn"> | NCTN: ca_objects.nct.nctn</ifdef><ifdef code="ca_objects.rve.rvel"> | RVEL: ca_objects.rve.rvel</ifdef><unit relativeTo="ca_objects.inv" delimiter="#" start="0" length="1" sort="ca_objects.inv.inv_def" sortDirection="DESC"><ifdef code="ca_objects.inv.invn"> | N. Inv: ca_objects.inv.invn</ifdef></unit><ifdef code="ca_objects.ogtd"> | OGTD: ca_objects.ogtd%truncate=63&%ellipsis=1</ifdef><unit relativeTo="ca_objects.sgti" start="0" length="1"><ifdef code="ca_objects.sgti"> | SGTI: ca_objects.sgti%truncate=63&%ellipsis=1</ifdef></unit> },
titolo_dinamico_Contenitore_rule = {
table = ca_objects,
restrictToTypes = [ente_aderente,cart_contenitore],
mode = overwrite,
target = ca_objects.titolo_dinamico,
template = <unit relativeTo="ca_objects" start="0" length="1">ca_objects.preferred_labels.name (ca_objects.idno)</unit>
},
#fine regola per aggiornamento titolo dinamico, antonio cassano 21/02/2020
#nuova regola per prestiti
loan_idno_rule = {
table = ca_loans,
mode = overwrite,
target = ca_loans.idno,
skipIfExpression = ca_loans.idno = ca_loans.loan_id,
template = ca_loans.loan_id
},
prova idno rep
idno_rep_rule = {
table = ca_object_representations,
mode = overwrite,
target = ca_object_representations.idno,
skipIfExpression = ca_object_representations.idno = ca_object_representations.representation_id,
template = ca_object_representations.representation_id
},
fine prova indo rep
#inizio regole idno 15/11/2021
idno_occ_rule = {
table = ca_occurrences,
mode = overwrite,
target = ca_occurrences.idno,
skipIfExpression = ca_occurrences.idno = ca_occurrences.occurrence_id,
template = ca_occurrences.occurrence_id
},
idno_place_rule = {
table = ca_places,
mode = overwrite,
target = ca_places.idno,
skipIfExpression = ca_places.idno = ca_places.place_id,
template = ca_places.place_id
},
idno_entity_rule = {
table = ca_entities,
mode = overwrite,
target = ca_entities.idno,
skipIfExpression = ca_entities.idno = ca_entities.entity_id,
template = ca_entities.entity_id
},
idno_coll_rule = {
table = ca_collections,
mode = overwrite,
target = ca_collections.idno,
skipIfExpression = ca_collections.idno = ca_collections.collection_id,
template = ca_collections.collection_id
},
idno_storage_loc_rule = {
table = ca_storage_locations,
mode = overwrite,
target = ca_storage_locations.idno,
skipIfExpression = ca_storage_locations.idno = ca_storage_locations.location_id,
template = ca_storage_locations.location_id
},
#fine regole idno
#entita gestione gerarchia
entity_ente_gerarchia_rule = {
table = ca_entities,
restrictToTypes = [org],
mode = overwrite,
target = ca_entities.parent_id,
skipIfExpression = ca_entities.parent_id = 89998,
template = 89998
},
entity_persone_gerarchia_rule = {
table = ca_entities,
restrictToTypes = [ind],
mode = overwrite,
target = ca_entities.parent_id,
skipIfExpression = ca_entities.parent_id = 89999,
template = 89999
},
entity_famiglia_gerarchia_rule = {
table = ca_entities,
restrictToTypes = [fam],
mode = overwrite,
target = ca_entities.parent_id,
skipIfExpression = ca_entities.parent_id = 90000,
template = 90000
},
#entita fine gestione gerarchia
#oggetti gestione ordinamenti
path_hier_object_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.path_hier_object,
template = <unit relativeTo="ca_objects.hierarchy" delimiter="/">^ca_objects.object_id</unit>
},
##gerarchico
sort_hier_rank_object_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.sort_hier_rank_object,
template = <unit relativeTo="ca_objects.hierarchy" delimiter=".">ca_objects.rank</unit>
},
##nctn e rvel
sort_nctn_rvel_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.sort_nctn_rvel,
template = <ifdef code="ca_objects.nct.nctn">ca_objects.nct.nctn</ifdef>
<ifnotdef code="ca_objects.nct.nctn">0</ifnotdef>-
<ifdef code="ca_objects.rve.rvel">ca_objects.rve.rvel</ifdef>
<ifnotdef code="ca_objects.rve.rvel">0</ifnotdef>
},
##invn
sort_invn_rule = {
table = ca_objects,
mode = overwrite,
target = ca_objects.sort_invn,
template = <unit relativeTo="ca_objects.inv" delimiter="#" start="0" length="1" sort="ca_objects.inv.inv_def" sortDirection="DESC">ca_objects.inv.invn</unit> }
#fine oggetti gestione ordinamenti
}