Start a new topic

Deceased = Yes flag, want to add current date for 'Deceased Date' field

Hi there,


We have configured our import to tick the Deceased Check box in Bio1 when the TM company returns a value of Yes in the Deceased Flag field.


This works fine for the check box but we want to also ensure that the Deceased Date field in Bio1 has the current date added to it. Upon import, these records have this field as blank at the moment. 


I have also tried adding a virtual field to update the Deceased Date with the current date based on a seed of the Deceased flag field but it still adds the Deceased Date and hence the flag to every record in the import.


Wondering if there might be a way to add the Deceased Date virtually perhaps with a dictionary and a RegEx that uses the Yes to populate with today's date?


Grateful for your help.


Cheers,


Tessa


Tessa, personally I would not use RegEx for this - I would insert one line of code in your 'afterdictionary' section - something like;

If import.Fields.GetbyExcelName("[whatever your deceased flag column is").Value="Yes" then

  import.Fields.GetbyExcelName("whatever your deceased date column is").Value=Date()

End if


Note: none of the above is tested or syntactically checked


Thanks, Dennis dennis@ladnierfamily.com

Thanks Dennis,


I have added the below code into the API but get the following errors:


If Import.Fields.GetByExcelName("CD").Value = "Yes" Then Import.Fields.GetByExcelName("CM").Value = Date()

  End If


image


Tessa, as noted, the code was not tested or syntactically checked - however the below was so should work.


   If Import.Fields.GetByExcelName("CD").Value = "Yes" Then

         Import.Fields.GetByExcelName("CM").Value = DateTime.Now.ToString("dd/MM/yyyy")

  End If


Thanks, Dennis dennis@ladnierfamily.com

Login or Signup to post a comment