CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Can't update value in editable grid before update

Print topic Send  topic

Author Message
Jason
Posted: 09/18/2003, 7:00 AM

I have an editable grid that has just 4 fields: server, monitoringstatus, statustime, enabletime. The grid allows secured access to enabled/disable monitoring on servers that dedicated SA's support.

We use Tivoli TEC to process monitoring events, and upon reception of an event, the correlation rules check the database values behind this editable grid for the server's monitoring status. If it is disabled, it disregards the event.

The STATUSTIME and ENABLETIME values are EPOCH fields in the database, but I want to display the date/time on the editable grid using the Popup Date Picker and text box for the date, and a listbox with 30 min increments for the time. Upon submitting the form, I want to convert the date/time fields to epoch and place the value in a hidden field (ENABLETIME) which is tied to the database.

I have tried adding the conversion code to the 'OnValidate' (for the control, not the form), 'BeforeBuildUpdate', 'BeforeExecuteUpdate' events, and it only works on the 'OnValidate' event for the ENBALETIME control. However, although the hidden field is populated with the epoch value during the OnValidate event, it is not getting put in the database during the update.

I am not getting any errors, and the value appears to be in the field (I have created an error in the OnValidate event after my code to display the epoch value from the ENABLETIME field, and it is correct). But the value just doesn't get updated.

I am also using DataSource Columns in my custom update criteria.

BASICALLY:
Update sma_hostname set monitoringstatus='{datasource column:monitoringstatus}', statustime='{datasource column:statustime}', enabletime='{datasource column:enabletime}' where hostname='{datasource column:hostname}'

Does the value I assign in the OnValidate event get overwritten by CCS before update? If so, does anyone know how to do this with an editable grid? The documentation (both with CCS and on the web) are lacking in the editable grid support area...

Thanks,
J
Jason
Posted: 09/18/2003, 1:18 PM

I figured the above problem out. You have to use the query builder and specify a primary key in order to use the DataSource Column value in the where clause of your custom update. The values to update should be 'Control' values.

However, I only want to update rows that have changed since the page was loaded - NOT every row in the grid.

Does anyone know how to remove rows from the update that have not changed? The reason being that if 2 people loaded the page at the same time, and 1 person disables monitoring on a server, the 2nd person's form will still show enabled in their view. If all rows are submitted, the 2nd person's form will overwrite the 1st person's entry, who just set it to disabled.

Venom
Posted: 11/15/2003, 4:31 PM

Hi Jason.

Try this:
1. Create a variable before updating the record, and change it's value to concatenated content of all table cells of the grid.
2. In the "WHERE" clause of the "Update" operation, add newly created variable and compare it to concatenated fields of the database. If you want to update only those records that has been changed, the comparision operator should be "<>".

I hope it will help you with your problem.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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