Search code examples
kentico

Kentico - Change Pagetype Field Name without blanking out current values


I have a custom page type for Staff and there's a field called Function. I have a WHERE condition in a repeater like this: Function LIKE '%insurance%' and got an error Incorrect syntax near the keyword 'Function'

From the error I guess Function is a reserved keyword, so I changed the field name to BusinessFunction. However right after changing the field name, I noticed all the values for that field become blank. If I changed it back, the values are back to normal. The question: is there a way to change the field name while keeping the values that are already there -- without access to the backend database?


Solution

  • Wrap the word Function in brackets like so should resolve the problem: [Function]

    When you say the values of the field are blank do you mean on the display side in the repeater? Have you changed the transformation to use the new field name? Have you updated the Columns property of the repeater to use the new field name vs. the old one? It will not lose all the data, you just need to ensure all the values of the property/field name are updated everywhere including any custom code you might be using for this page type.