cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
gianpaolo
Level IV

string and variable concatenation

Hello,

i would like to create a new column based on result of another column, 

but i'm not able to write into column the results in case of third option, probably due to concatenate error...(see log below) 

 

note"

low and high are numeric variables previousy declared.

 

   

 

Summary_Stat << New Column( "SUMMARY_CPK_SPEC_Limit",
    Formula(
        If(
            :Name( "CPK(SPEC_Limit)" ) < low, "too Low CPK",
            If(
                :Name( "CPK(SPEC_Limit)" ) > high, 

                    "too high CPK", 

                "good CPK between " || Low || " and " || high || " ",
            ),
        )
    )
);

 

 

Column SUMMARY_CPK_SPEC_Limit Formula Interrupted

argument should be character 1 times At rows: 2 Operation: Concat, Bad Argument( Low ), "good CPK between " || /*###*/Low || /*###*/" and " || /*###*/high || /*###*/" " /*###*/

 

Gianpaolo Polsinelli
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: string and variable concatenation

You need to declare the column as being of a Data Type, Character and in order to concatenate numeric variables, they need to be converted to character references, char()

Summary_Stat << New Column( "SUMMARY_CPK_SPEC_Limit",
	Character,
	Formula(
		If(
			:Name( "CPK(SPEC_Limit)" ) < low, "too Low CPK",
			If(
				:Name( "CPK(SPEC_Limit)" ) > high, "too high CPK",
				"good CPK between " || char(Low) || " and " || Char(high) || " ",
			),
		)
	)
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: string and variable concatenation

You need to declare the column as being of a Data Type, Character and in order to concatenate numeric variables, they need to be converted to character references, char()

Summary_Stat << New Column( "SUMMARY_CPK_SPEC_Limit",
	Character,
	Formula(
		If(
			:Name( "CPK(SPEC_Limit)" ) < low, "too Low CPK",
			If(
				:Name( "CPK(SPEC_Limit)" ) > high, "too high CPK",
				"good CPK between " || char(Low) || " and " || Char(high) || " ",
			),
		)
	)
);
Jim