Jump to content


Photo
- - - - -

How to Update on DELETE


4 replies to this topic

#1 notchpaguia_062208

notchpaguia_062208

    Newbie

  • Members
  • Pip
  • 6 posts
  • Gender:Male
  • Location:Philippines
  • Interests:Programming

Posted 05 September 2005 - 01:38 PM

Good day guys!

I'm a newbie in PRO-IV and I'd dearly appreciate any help from you.

This is the situation, I have 2 files, COMPFILE & SMANFILE

A field in COMPFILE is TOTAL_SALESMAN

I am maintaining SMANFILE, how could I deduct from TOTAL_SALESMAN(COMPFILE)
whenever I delete a record from SMANFILE?

How do I use @MODE to capture the current mode of the file? Or maybe screen?
I've tried coding it on Before Write of SMANFILE and call an LU to update my COMPFILE
but it doesn't work...

Wish you could help me on this guys.

Thank you so much and more power!
It's better to ask than to commit mistakes...

#2 Neil Hunter

Neil Hunter

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:Johannesburg, South Africa

Posted 05 September 2005 - 03:15 PM

How are you deleting the records from SMANFILE ? Screen or Update ?

The following should work in both cases :

LS1
COMPFILE Change Mode

LS2
SMANFILE Delete Mode

On Before Write of SMANFILE

IF @MODE = 'D' THEN
TOTAL_SALESMAN -= [VALUE]
ENDIF

I might also be way off the mark, its been a long day :p B)

*Edited to add* You will probably have to refresh TOTAL_SALESMAN if its being displayed on screen
ie TOTAL_SALESMANTagName.Refresh()

Edited by Neil Hunter, 05 September 2005 - 03:17 PM.


#3 Mike Nicholson

Mike Nicholson

    Expert

  • Members
  • PipPipPipPip
  • 196 posts
  • Gender:Male
  • Location:Stockholm, Sweden

Posted 05 September 2005 - 11:15 PM

Just a note. If it's an update that will only work if the cycle is in 'D'elete mode. If you are on an update you probaby don't need the IF part, just the subtraction line.

Cheers

Mike

#4 notchpaguia_062208

notchpaguia_062208

    Newbie

  • Members
  • Pip
  • 6 posts
  • Gender:Male
  • Location:Philippines
  • Interests:Programming

Posted 06 September 2005 - 01:36 PM

Thanks for the help guys. Actually, I already did it just before I checked for your replies... hehehe... thanks for those... I'll try to keep in mind all your suggestions...
It's better to ask than to commit mistakes...

#5 xxRMxx

xxRMxx

    Newbie

  • Members
  • Pip
  • 1 posts
  • Gender:Male

Posted 07 September 2005 - 10:40 PM

Do you still want to delete the record in SMANFILE it the VALUE = 0?

If not, you may want to add an extra condition:

IF [VALUE] <> 0 THEN
TOTAL_SALESMAN -= [VALUE]
ELSE
DSEL
ENDIF

Ta.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users