Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Buffer problems within Update Trigger
Message
From
03/05/2002 01:12:40
 
 
To
02/05/2002 19:34:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00652180
Message ID:
00652253
Views:
30
>Hey UTers!
>
>I *tried* to find an answer for this in the archives, but to no avail.
>
>I have a program that runs during the Update Trigger. What I'm trying to do is send the data out to an ASCII file as well as writing it to the table. I'm using a SELECT based on the key to make a cursor and then copy to ASCII.
>
>For legal reasons, I need to use the trigger. The problem is when I send the data, it is the OLD data. I tried adding a =TABLEUPDATE(with all combo of switches inside here) before the SELECT, but the SELECT still finds the old data!
>
>I have a workaround which is to SCATTER MEMVAR and use the memvar values in the SELECT, but this is kludgey. ALso, the product I'm using also has a VFP/SQL version I *know* this workaround won't work for.
>
>Can anyone tell me how I can devine the NEW values and get them into my cursor?
>
>Thanks in advance to all who answer...
>
>-- John

John,

As far as I know, the select won't work. The data is not committed until you exit the (top level) trigger successfully.

The select you are doing is a bit of an overkill imo. you are sitting on the data.

why not
&& in the trigger
local obj

scatter memo name obj
=ExportAscii(obj)
function ExportAscii(obj)
    local i, n, aa[1], member, x, out
    
    out = ''
    n = amembers(aa, obj)
    for i = 1 to n
        member = aa[i]
        x = obj.&member
        t = type(x)
        do case
        case isnull(x)
             x = '.Null.'

        case inlist(t, 'C', 'M' )

        case inlist(t, 'D', 'T', 'B', 'I', 'F' , 'N')
	     x = transform(x) 

        case t == 'L'
	     x = iif(x, 'TRUE', 'FALSE' )
        
       case t == 'Y'
	     x = transform(x)

       otherwise
             x = ''
       endcase
       
       out = out + iif(empty(out), '', chr(13)+chr(10))
       out = out + member + ':' + x
    endfor

    ? out
endfunc
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform