Edge User Group Discussion Forum |
Non-destructive update | |
Can it be done? | Bob Smucker | 04/19/01 | |
Re:Can it be done? | Crispin Bates | 04/19/01 | |
Yes | Bob Smucker | 04/20/01 |
Post new message in this thread
Date: April 19, 2001 04:35 PM
Author: Bob Smucker (bsmucker@prosys.com)
Subject: Can it be done?
Hi fellow Plex deviants,
I need a non-destructive update function,
which allows updating all values not previously entered, but refuses to update
an existing value.
My strategy is to compare variables A and B, populated
by the same view, and update B conditionally. For each field, if empty in B but
not in A, set B = A. If A and B have different non-empty values, stop and report
an error.
I can do it with brute force, one lousy field at a time, but I
don't see any way to do it with meta code. And I have about 60
fields.
Anyone?
(http://mondrian.sba.com/forums/Index.cfm?CFApp=82&Message_ID=60295)
Date: April 19, 2001 06:25 PM
Author: Crispin Bates
(cbates@cpulink.net)
Subject: Re:Can it be done?
Bob,
Could you not do something like this.
Sub
Test
Comment Determine which fields are empty in View
+For Each
Field View
Set CountL<Number> = CountL<Number> +
<Number.*One>
Use EmptyL, CountL<Number>
++If Empty
Set
EmptyL<YesNo> = <YesNo.Yes>
++Else
Set EmptyL<YesNo> =
<YesNo.No>
Set CountL<Number> =
<Number.*Zero>
+++Define Field: FIELDS/+Field
+For Each
Field Input
+++Set Value To Current Field: FIELDS/+Field
Set
CountL<Number> = CountL<Number> + <Number.*One>
Use
EmptyL, CountL<Number>
++If Empty
Comment Input field is
Empty
++Else
++If NE View
Comment NE View field value
If
EmptyL<YesNo> == <YesNo.Yes>
View field is empty so update with
input
++Cast To View, Field: FIELDS/+Field
Else
Comment View is not
empty so error
Crispin.
(http://mondrian.sba.com/forums/Index.cfm?CFApp=82&Message_ID=60310)
Date: April 20, 2001 09:14 AM
Author: Bob Smucker
(bsmucker@prosys.com)
Subject: Yes
Thanks Crispin, this is right on target.
(http://mondrian.sba.com/forums/Index.cfm?CFApp=82&Message_ID=60358)