CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Unique for multiple fields

Print topic Send  topic

Author Message
Lizam
Posted: 10/23/2005, 7:15 PM

Hi,

Anyone knows how to do this in CCS? Below code is not working for EDITABLE GRID. The combined fields are company_id and product_id.

On Validate:

$g_cnt = CCDLookUp("count(*)","detail","company_id=".
CCGetParam("company_id"). " AND product_id=".
$grid->product_id->GetValue(),$DB);

if ($g_cnt <> 0) {
$grid->Errors->addError("Record already exist!");
}

Thanks in advance.
Lizam
Posted: 10/25/2005, 7:00 PM

Hi,

Found out the workaround finally. Below is what I did:

1. On the design mode, set the Unique property of company_id to 'Yes'.

2. View the CCS generated php code and look for function ValidateRow($RowNumber) and change the code that check for the existance of value (CCDLookUp) to include the other field (product_id)

if(CCDLookUp("COUNT(*)", "detail", "company_id=" .
$this->ds->ToSQL($this->ds->company_id->GetDBValue(), $this->ds->company_id->DataType) .
" AND product_id=" .
$this->ds->ToSQL($this->ds->product_id->GetDBValue(), $this->ds->product_id->DataType) .
$Where, $DB) > 0)

Best regards.

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 http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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