You are viewing limited content. For full access, please sign in.

Question

Question

Template Field Changes

asked on January 6, 2016

I need to change a field in a template.  This template is currently used in all of our documents.

I want to change the Field "Invoice Date" which has a Type of Text  width of 10 to Type Date.

I have created a "Date" field with short Date Format.

How do I transfer the data from "Invoice Date" to the new "Date" field?

I believe I can then change my "Invoice Date" Type to date format and then move the data back to the changed "Invoice Date" field?

It is my understanding that if I change the Type without doing something like this that I will lose all my exsisting data.

0 0

Replies

replied on January 6, 2016

Usually the case is that changing the type of most fields to Text will retain the data with little to no issues. I would do a back up of the Laserfiche database prior to making any changes to the metadata field so if you were to roll back you would be able to do so. Since you are going from type Text to type Date, I would suggest using Workflow to copy the data to a duplicate/similar named field that is of type Date. Once you have confirmed that the data is correct you can remove the old metadata field and add the new one to the template. I do highly recommend before making any of these changes to back up the database as that is where all the metadata is located for the documents.

0 0
replied on January 7, 2016 Show version history

I have created a new template for testing purposes.  I have attached the 2 Fields "Invoice Date" and "Date".

The text data that is in "Invoice Data" entered in via quickfields OCR.  It displays in MM/dd/yyyy format.

When I run my workflow to move the data using short date or custom MM/dd/yyyy format, the results I get are dd/MM/yyyy. If the data in day is over 12 for the dd then workflow errors with invalid date.

0 0
replied on January 7, 2016

Date values are formatted by default based on the Windows date format for the user. It sounds like on the Quick Fields machine you have it in the MM/dd/yyyy format while on the Workflow machine it's dd/MM/yyyy. Keep in mind that the Workflow one is from the perspective of the user specified in the login for the Workflow Server service.

Normally, with date fields, this wouldn't be a problem because the Laserfiche Server would automatically adjust the format based on the user's date settings. But since the original field is text not a date, this conversion does not happen.

There are 2 things you could do: adjust the date format on the Workflow server or format the data you read from the text field. The first one is possible but not straightforward and possibly with consequences for other workflows or software that may have assumed the dd/MM/yyyy format.

Formatting the data is easier. I'm assuming that your workflow has 2 activities, one that reads the field value from "Invoice Date" and one that writes it to the "Date" field using the token from the first one. On the Assign Field Values activity, right-click on the token and choose Token Editor from the context menu. Then check the "Apply formatting" box and enter the dd/MM/yyyy format. One caveat here is that because the starting value is text, it may not always be converted as expected. For ex, a date like 1/4/2015 (Jan 4 with MM/dd format) will stay as is because it's a valid date in the dd/MM format as well.

 

0 0
replied on January 7, 2016

I just tried the method of creating a token and it this transfers the correct dates  until the day is over 12.  Then the workflow fails.  Both Quick Fields and Workflow are on the same server. It appears that it is set to MM/dd/yyyy, as the activities and message logs they display this format.

Unless someone has a solution. I will abandoned this part of my plan. 

I will be doing SQL query to fill my fields.  I will just continue with the OCR for the "Invoice Date" and then do the rest of my fields via SQL query.

0 0
replied on July 15, 2020

HI, I am currently experiencing a similar situation.

I am working on creating a template for new record type. This new template utilizes fields already existing in an older template that we have been using for a different content type. Publication Date is common field between the two templates. While working on the new template, I changed the Publication Date field type from Date to Text. To my surprise, the change reflected in the older template as well. Now I have to reverse the change, but I am concerned that I may experience data loss.

I was considering the following steps to fix the issue:

  1. Create a temporary date field in the old template
  2. Create a workflow to copy the values from the Publication Date field to the temporary date field that I just created
  3. If all data copied successfully then:
  4. Change the Publication Date field type from Text to Date
  5. Create a workflow to copy the values from the temporary date field back to the revised Publication Date
  6. Check the data to ensure the the workflow is successful
  7. Delete the temporary date field

 

I would appreciate it if anyone can share with me their thoughts on how to design/code the workflows. Or if you have a better solution then please let me know. Thank you.

0 0
replied on July 16, 2020 Show version history

That shouldn't be necessary. The Laserfiche Administration Console will warn you if there are any values that don't match the new field format (that always happens when you go from a more permissive format, like text, to a more restrictive one, like date).

As for the field changing for all templates, field properties like type and length are per field and not per template.

Corrected based on discussion below: converting from a more restrictive to a more permissive data type (for ex, date to text) will preserve existing data. Converting from a more permissive to a more restrictive data type (for ex, text to date) will discard all existing field values.

 

0 0
replied on July 16, 2020

HI Miruna,

 

Thanks for feedback.

 

Just to confirm does this mean that I should not lose any data when I convert the Publication Date field type again from Text to Date? 

 

The date formats in the field where yyyy-MM-dd.

 

Thanks,

 

Wissam

0 0
replied on July 16, 2020

The date format is for display only, it does not affect how the data was stored. If you convert from date to text and back to date, any field values that are proper dates should be fine. If users added any data while the field was set as text, the admin console will warn you so you can find them and correct them.

0 0
replied on July 21, 2020

Hi - Publication Date experienced 100% data loss when I converted it back to Date field type from Text field type. The data were all formatted properly. I am proceeding as per the plan I outlined above. Just wanted you to be aware of this. Thanks.

0 0
replied on July 22, 2020

Thanks for letting me know. I went digging some more and it turns out I was wrong. The conversion from a more permissive to a more restrictive data type will discard all data. I will update my post above and see if we can get this behavior documented.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.