Expand my Community achievements bar.

Problem with 'IF' and Referencing other field's values

Avatar

Former Community Member
Hello,



It seems that every time I get 3 steps ahead, it ends up being just 2 UGH



Im having trouble referencing other fields/objects values within an IF expression (other expressions with references have the same result).



The field NPI_1 is conditional upon 2 factors:

Field DOS_FR_1 has a value and P_SIGN has a certain name, in which will dictate the value of NPI_1



Eventually this will use elseif for 3 names and their respective id #s



Unfortunately, I cant even get the 1st part to work.



Ive tried everything I can think of - and it just wont accept the = in my expression. I keep having this problem obviously Im missing something.



Thank you sooo much for your help.



The following is the error I keep getting



FormCalc: Error: syntax error near token = on line 1, column 56.



Javascript: expected ), line 1



if ( ( HasValue(DOS_FR_1) ) and ( A.P1.P_SIGN.rawValue = "TERRY TAYLOR SMITH, LMFT" ) ) then

NPI_1.rawValue = "1508879974"

endif



if ( ( HasValue(DOS_FR_1) ),( A.P1.P_SIGN.rawValue = "TERRY TAYLOR SMITH, LMFT" ) ) then

NPI_1.rawValue = "1508879974"

endif



if ( ( HasValue(DOS_FR_1) ) and ( P_SIGN.rawValue = "TERRY TAYLOR SMITH, LMFT" ) ) then

NPI_1.rawValue = "1508879974"

endif



if ( HasValue(DOS_FR_1) and P_SIGN.rawValue = "TERRY TAYLOR SMITH, LMFT" ) then ;

NPI_1.rawValue = "1508879974"

endif



I even tried the short version:



if ( A.P1.P_SIGN = "TERRY TAYLOR SMITH, LMFT" ) then

NPI_1.rawValue = "1508879974"

endif



**PS

This works fine:

if ( HasValue(DX1) AND HASVALUE(DOS_FR_1) ) then "1"

else " "

endif



It's the = that's giving me a hard time.
1 Reply

Avatar

Former Community Member
You are mixing javascript and formcalc. Make your script javascript (that is the format of the if, then , else that you have set up now) then when you want to compare two values use a double equal sign (==).

There are many resources in the web that will explain the if then else structure on the web.