MID
The MID function extracts a specified number of characters from a text string, starting at a specified position.
Applicable to
Calculated Columns
Return Value
- The MID function returns a text string containing the specified number of characters from the input text string, starting at the specified position.
- If start number is greater than the length of text, the function returns an empty string.
- If number character is greater than the number of characters remaining after the start position, the function returns all remaining characters.
Remark
- If start number is less than 1, the function returns an empty string.
- If number character is less than 1, the function returns an empty string.
- If text is a NULL value, the function returns NULL.
- The first character in the text string starts at position 0.
- MID function is applicable only for text values
Syntax
MID(<expression>,chars, start)
MID in Calculated Columns
Expression | A placeholder in a function that is replaced with the actual widget and measure names. |
---|---|
Column Name | The name of the column in the dataset or Datasource that contains the values you want to analyze. |
Chars | Number of characters to extract from the text string |
Start | Start position of characters to extract from the text string. |
Steps to Use MID Function
- Write the MID function. For instance
MID(<expression>,chars,start)
- Replace
<expression>
withVALUE([Column Name])
and replacenumber
with the starting position from which to extract characters and the number of characters to extract from the text string. - Replace the Column Name with the actual name of your column required.
- To learn how to add calculated columns in Infoveave, visit the section Calculated Columns.
Objective Consider that you have the below dataset, your goal is shortening the product description.
PRODUCT ID | PRODUCT NAME | DESCRIPTION |
---|---|---|
1 | Apple iPhone 13 | The latest iPhone model from Apple. |
2 | Samsung Galaxy S21 | Samsung’s flagship smartphone. |
3 | Google Pixel 6 | Google’s premium Android smartphone. |
You can use the MID function like
MID(VALUE([DESCRIPTION]), 0,10)
The new calculated column “Short Description” will return
PRODUCT ID | PRODUCT NAME | DESCRIPTION | SHORT DESCRIPTION |
---|---|---|---|
1 | Apple iPhone 13 | The latest iPhone model from Apple. | The latest |
2 | Samsung Galaxy S21 | Samsung’s flagship smartphone. | Samsung’s |
3 | Google Pixel 6 | Google’s premium Android smartphone. | Google’s p |