Forum Discussion
How to add / Subtract Character for SUBSTRING - causing some data type issue wrong data type or has
- 4 years ago
Hi Anonymous ,
Because there are 0 values in the return value of your variable "Var Len_First = SEARCH("First",'Require Comment'[Note Comment],,0)", and the -1 will exist after subtracting 1. And using -1 as an argument in the function LEFT will result in an error.
Please try modifying the variable to the following formula.
Var In_Substring = LEFT ( RIGHT ( 'Require Comment'[Note Comment], TotalLenght ), IF ( Len_FirstCallback = 0, 0, Len_FirstCallback - 1 ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Samarth_18
Thanks much for your quick response, I have tried it but still it is throwing the same error as below.
My observation is as below,
var TotalLenght = LEN(''Require Comment'[Note Comment]) -- NO issue with this Variable
But my assumption , the issue cause one is the below one
Var Len_First = SEARCH("First",'Require Comment'[Note Comment],,0)
The output i get is 99 , but i want to consider till 98
the same above when i try to add -1 its not doing it
Var Len_First = SEARCH("First",'Require Comment'[Note Comment],,0) -1
its throwing wrong value
So alternately i tried to do as below
Var Len_First = LEN(SEARCH("First",'Require Comment'[Note Comment],,0)) -1
Its also giving wrong out and trowing the same error "An Argument of function 'LEFT' has the wrong data type or has --an invalid value"
Need support on this how to fix, bec i need to do the similar measures for 4 , if i fixed one i can solve remaining where i need to add + 10 and + 15 for that
Thanks
Anonymous Please try this:-
m =
VAR Len_First =
SEARCH ( "First", 'Require Comment'[Note Comment],, 0 )
VAR TotalLenght =
LEN ( 'Require Comment'[Note Comment] )
VAR Substring1 =
IF (
Len_First <> blank,
LEFT (
RIGHT ( 'Require Comment'[Note Comment], TotalLenght ),
INT ( Len_First ) - 1
)
)
RETURN
Substring1- Anonymous4 years agoNot applicable
- Samarth_184 years ago
Community Champion
Anonymous Seems now error is different so you can try this now:-
m = VAR Len_First = SEARCH ( "First", 'Require Comment'[Note Comment],1, 0 ) VAR TotalLenght = LEN ( 'Require Comment'[Note Comment] ) VAR Substring1 = IF ( Len_First <> blank, LEFT ( RIGHT ( 'Require Comment'[Note Comment], TotalLenght ), INT ( Len_First ) - 1 ) ) RETURN Substring1