Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4153 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted
I'm not sure why this isn't working, but I have a dynamic SQL SELECT statement where both the number of fields/arguments and field values is dynamic. The problem I'm running into is when one of those values is a button container field with multiple reps. The following only represents the part of the calc that is not working. I've pulled this out and having playing with in the data viewer and I can't seem to figure out what's going wrong. Any help would be much appreciated. 
 
Let([
$SELECT_Items = " SELECT " & GFN (Items::kp_ITEMid ) & 
" FROM " & GTN (Items::kf_Title ) & "WHERE ";
  $Button = GFN (Items::Button_Log) & " = ? ";
  $Status = GTN (Items::Icon_Log) & "::" & GFN (Items::Icon_Log[2])
 
];
 
//This returns values
ExecuteSQL ( $SELECT_Items & $Button; ""; ¶; Items::Icon_Log[2] ))
This returns nothing
ExecuteSQL ( $SELECT_Items & $Button; ""; ¶; $Status ))
Posted

(first off: not a good idea to delcare local variables in your let like this: they will live for the remainder of the script.  Calc variables for the scope of the calc should not have the $ or $$ prefix.  Many developers use the underscore as the prefix for calc variables)

 

The issue is probably in this section:

$Status = GTN (Items::Icon_Log) & "::" & GFN (Items::Icon_Log[2])

 

if you mean that status should be equal to the value of the field you should do something like below.  Note that I broke out the SQL syntax into its own variable (_sql) so that you can more easily see it.

 

Let([
_SELECT_Items = " SELECT " & GFN (Items::kp_ITEMid ) & " FROM " & GTN (Items::kf_Title ) & "WHERE ";
_Button = GFN (Items::Button_Log) & " = ? ";
_Status = evaluate( GTN (Items::Icon_Log) & "::" & GFN (Items::Icon_Log[2])) ;
_sql = _SELECT_Items & _Button
 
];
 
ExecuteSQL ( _sql ; ""; ¶; _Status ))

 

)

  • Like 1

This topic is 4153 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.