April 13, 20205 yr Newbies Hello, I'm trying to do an auto enter calculation with an IF statement when importing data. I have one field that will either have an IP address or a computer name. If the field is a computer name, i want to strip out some of the text before the actual computer name. The format of the field with a name is (DOMAIN\computer-name), I'm attempting to strip the DOMAIN\ out and just return the computer name. If I do the calculation without the if statement then it works, for the computer name, but removes the IP address. This is the formula that I have If ( Position ( Self ; "\" ; 1 ; 1 ); GetValue(Substitute(TextFormatRemove(Self); "\"; ¶); 2); Trim(TextFormatRemove(Self)) ) Basically if the string has a "\" then apply the GetValue… line, otherwise do the Trim Line. The error i'm getting is Quote A number, text constant, field name or “(” is expected here. Any help would be greatly appreciated.
April 14, 20205 yr 3 hours ago, maxbehr said: If I do the calculation without the if statement then it works Does it really? The expression: GetValue(Substitute(TextFormatRemove(Self); "\"; ¶); 2) alone should generate an error, because it contains a text constant that does not end with a quotation mark. That's because the backslash character is an escape character; to include a literal backslash in a text constant, you must escape it itself: GetValue(Substitute(TextFormatRemove(Self); "\\"; ¶); 2) and likewise: Position ( Self ; "\\" ; 1 ; 1 )
Create an account or sign in to comment