sf_merge | R Documentation |
This function combines records of the same object type into one of the records, known as the master record. The other records, known as the victim records, will be deleted. If a victim record has related records the master record the new parent of the related records.
sf_merge( master_id, victim_ids, object_name, master_fields = character(0), api_type = c("SOAP"), control = list(...), ..., verbose = FALSE )
master_id |
|
victim_ids |
|
object_name |
|
master_fields |
|
api_type |
|
control |
|
... |
arguments passed to |
verbose |
|
tbl_df
of records with success indicator
## Not run: n <- 3 new_contacts <- tibble(FirstName = rep("Test", n), LastName = paste0("Contact", 1:n), Description = paste0("Description", 1:n)) new_recs1 <- sf_create(new_contacts, object_name = "Contact") # merge the second and third into the first record, but set the # description field equal to the description of the second. All other fields # will from the first record or, if blank, from the other records merge_res <- sf_merge(master_id = new_recs1$id[1], victim_ids = new_recs1$id[2:3], object_name = "Contact", master_fields = tibble("Description" = new_contacts$Description[2])) # check the second and third records now have the same Master Record Id as the first merge_check <- sf_query(sprintf("SELECT Id, MasterRecordId, Description FROM Contact WHERE Id IN ('%s')", paste0(new_recs1$id, collapse="','")), queryall = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.