CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> CodeCharge Studio -> Wishes

 Conditional Retrieve Value for Control

Print topic Send  topic

Author Message
Posted: 01/07/2011, 8:25 AM

I find that I have to do this a lot...

For a data entry record form, if I have an input field where I need to
retrieve a default value for it, the Retrieve Value for Control action
works great.

However, if anywhere on the record form there's a data validation error,
then the value that the user may have changed in that input field will
get overwritten with the Retrieve Value for Control action again. A
real simple fix for this would be to add a conditional 'is null'
property parameter to the Retrieve Value for Control action.

Control Name: MyControl
Source Type: Expression
Source Name: "Mary had a little lamb"
Is Null: True

Would create this code:

if (CCStrLen($Component->GetText()) < 1) {
$Container->MyControl->SetValue("Mary had a little lamb");

If the 'Is Null' is set to False, then the condition would be removed.

The same could be applied to the DLookup action. Only do it if the
field control value is null.
Posted: 01/31/2011, 4:41 PM

Discovered that with PHP ternary logic can be used in the Retrieve Value
for Control action.

Control Name: My Control
Source Type: Expression
Source Name: (CCStrLen($Component->GetText()) < 1) ?
$Component->SetValue("Mary had a little lamb") : $Component->GetValue()

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.