Changing CDT Field Names


We have a CDT in our application to match an Excel file that is being uploaded. If the Excel template changes (ie. column headers are renamed and rearranged), what is the best practice for getting the CDT to match the new Excel file being imported?

If I edit the XSD of the CDT to match the new Excel template, will all dependencies automatically update under the CDT?

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer

    Hello  ,

    Since your excel template as mentioned will not have fixed column names, you will have to manually update your CDT and the best practice to do so is by updating the XSD file. 

    Coming to dependencies, you will have to manually update where you are using the map logic from your data to CDT (as it is not mentioned above in the question of how you are importing the data from excel, I'm assuming that you are using read excel function in the expression which needs to be updated when the CDT is being updated).

  • Because the field names can change anytime, I don't think it is practically possible to keep updating the CDT again and again. 

    Can you tell me about the use case or what you are trying to achieve? Maybe I have a better appraoch for you. 

  • Hi Rithani, so in this case it will be a one time change to the Excel template and will have fixed column names moving forward. For example, let's say the new version of the Excel template will have column headers 'Last Name, First Name, Address' instead of 'FN, LN, Address'. Notice each Excel file has the same three data points, but the order and name has changed in the file being uploaded to Appian. Since the current CDT matches the naming conventions of 'FN, LN, Address', I am wondering the best method to update the app to address this?

  • This is one of many reasons why I will never go back to using smart services to import Excel files again, since I've started using fn!readexcelsheetpaging(), also from the Excel Tools plugin.

    You have full control over casting data to your CDT, including type conversions, validations, etc.

    This eliminates the need of having a specific CDT that matches the Excel file, we simply bypass the header row and only use column index.

    This does not break if there is an issue in the file such as an empty row (I forget the cases).

    In this situation, if you switch to fn!readexcelsheetpaging() in an expression rule / script task for import, you don't have to modify your CDT.

      local!doc: cons!APP_UPLOAD_DOC,
      local!data: fn!readexcelsheetpaging(local!doc,0,a!pagingInfo(1,cons!APP_UPLOAD_MAX_ROWS)
              items: remove(local!,1),
              expression: {
                  id: null,
                  part: index(fv!item.values,1,""),
                  model: index(fv!item.values,2,""),
                  desc: index(fv!item.values,3,"")