Forum Discussion

JustinNgan's avatar
JustinNgan
Regular Visitor
9 years ago
Solved

MID error when using two calculated columns for integer parameters

I would like to use the MID function for a new column. MID (Text, Start Position, Number of Characters)   Note, both Position and Number of Characters are calculated columns.   When I check this...
  • JustinNgan's avatar
    JustinNgan
    9 years ago

    Whole numbers :-(  but I think you got it ... there are definitely some records where the value of the calculated columns are null/blank.  I guess I can use the function to calculate on only those with valid entries by wrapping an outer function to test for a number?

  • Trotzuk's avatar
    Trotzuk
    9 years ago

    I just confirmed that a blank being returned in a calculated column value will cause the error you posted. You can get around that by doing something like this:

     

    USERNAME = MID([LOG_MESSAGE], if(isblank([USERNAME_START]), 1, [USERNAME_START]), if(isblank([USERNAME_LENGTH]), 1, [USERNAME_LENGTH]))

     

    Not knowing what your data looks like, I just used the isblank to check to see if there is a blank value in the calculated column and then replaced the blank with a 1. Same with the length in the second parameter. You may have to pick other values, but that should prevent blanks from breaking your formula.