BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
smithwoosley
Occasional Contributor

Radio Box to Text

How can I turn a selection from a radio box into text?  Trying below with no luck.  Or is there some other simpler solution?

 

win = New Window( "Radio Box",
	<<Modal,
	<<ReturnResult,
	Panel Box( "Select",
		rbox = Radio Box( {"A-CMP-1", "A-CMP-2"} ),
		toolcode = rbox<<get text;
	),
);

DSNString= "Driver={SQL Server}; SERVER=rb; DATABASE=FAB; UID=fab; ";

sqlStr=

"
select vcLotCode, vcToolCode
from EDB.dbo.tFABDATA
where vcLotCode like 'Lot.1234'
and vcToolCode like '"|toolcode|"'
	
";

dt = Eval(Substitute(Expr(dt=Open Database(DataSource,sqlcode,"Lots");),Expr(sqlcode),sqlstr,Expr(DataSource),DSNString));
0 Kudos
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Radio Box to Text

I believe your issue is your concatenation operators.  In JSL a concatenation operator is  ||, not | as in your example

toolcode="zippy";

sqlStr=

"
select vcLotCode, vcToolCode
from EDB.dbo.tFABDATA
where vcLotCode like 'Lot.1234'
and vcToolCode like '"||toolcode||"'
	
";
Jim
smithwoosley
Occasional Contributor

Re: Radio Box to Text

Ah, that was one problem.

 

Also had to use "get selected" instead of "get text".  Also had to move "get selected" outside of the new window parenthesis.

 

Works now.  Thanks!

0 Kudos
3 REPLIES 3
txnelson
Super User

Re: Radio Box to Text

I believe your issue is your concatenation operators.  In JSL a concatenation operator is  ||, not | as in your example

toolcode="zippy";

sqlStr=

"
select vcLotCode, vcToolCode
from EDB.dbo.tFABDATA
where vcLotCode like 'Lot.1234'
and vcToolCode like '"||toolcode||"'
	
";
Jim
smithwoosley
Occasional Contributor

Re: Radio Box to Text

Ah, that was one problem.

 

Also had to use "get selected" instead of "get text".  Also had to move "get selected" outside of the new window parenthesis.

 

Works now.  Thanks!

0 Kudos
pmroz
Super User

Re: Radio Box to Text

You don't have to do as much manipulation for the call to the database.  Also evalinsert makes the sql a little cleaner.

win = New Window( "Radio Box",
	<<Modal,
	<<ReturnResult,
	Panel Box( "Select",
		rbox = Radio Box( {"A-CMP-1", "A-CMP-2"} ),
		toolcode = rbox << get selected;
	),
);

DSNString= "Driver={SQL Server}; SERVER=rb; DATABASE=FAB; UID=fab; ";

sqlStr = evalinsert(
"select vcLotCode, vcToolCode
   from EDB.dbo.tFABDATA
  where vcLotCode like 'Lot.1234'
    and vcToolCode like '^toolcode^'");

dt = open database(dsnstring, sqlstr, "Lots");