Skip to main content
Known Participant
May 14, 2021
Solved

On using import excel to database smart service getting this error : Incorrect integer value: '' for column `Appian`.`tablename`.`palletqtyno` at row 1???

  • May 14, 2021
  • 13 replies
  • 2 views

I am trying to use import excel to database smart service for importing my data from excel into appian table.

In my CDT i have columns of text and integer type. But when trying to use the excel file with integer column as blank it is throwing me error as:

Incorrect integer value: '' for column `Appian`.`testBT`.`palletqtyno` at row 1???

where testBt is my tablename and palletqtyno is my column name whose data type is defined as integer in CDT

    Best answer by csteward

    Ah yes, my sample code needs adjustment - as you have found, the result is actually a list of text string within local!data.result.values, vs a list of dictionary.  fv!item.values[2] or index(fv!item.values,2,null) would be the way to go.

    a!localVariables(
      local!data: fn!readexcelsheet(cons!CHRIS_TEST_SP_DOC,0,2), /* get the data */
    
      if(
        local!data.success, 
        a!forEach( 
          items: local!data.result,
          expression: 'type!{urn:com:gdit:types}COE_Sample_CDT'(
            id: null,
            approval: index(fv!item.values,1,null),
            requestByName: index(fv!item.values,2,null),
            requestById: index(fv!item.values,3,null),
          )
        ),
        {}
      )
    )

    13 replies

    csteward
    Brainy
    May 14, 2021

    Is your palletqtyno field configured to allow null values at the DB level?

    amang0002Author
    Known Participant
    May 14, 2021

    Yes null is allowed and data type is integer

    csteward
    Brainy
    May 14, 2021

    Working with Excel import/export can be a little finicky at times, especially related to data types.  I am not that familiar with this node - typically I will utilize fn!readexcelsheet() to import raw data, then cast it to a CDT, then write the CDT to the database with Write to Datastore Entity.  This allows you to avoid some of these issues with going straight to the DB and perform any manipulations, casting, etc in between as needed.