Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing a variable

Status
Not open for further replies.

sarahblovely

Programmer
Dec 9, 2002
8
0
0
CA
It has been years since I wrote in Foxpro but have been asked to create a new program for our work order system. I need a way to update a variable shown on the screen. I will have a variable which gives a running total of items allocated and an entry screen to allocate qty and dates of shipments. As the user inserts qty to ship on a certain date I want the allocation number to display the total qty allocated. I know it is some thing like show gets and read show but I can't get it to update the figure on the screen.
example
Backorder 50 Allocated 10
item qty date to ship
a 10 jan 15

now if the user enters another 10 to ship in febuary I want the allocated number to change to 20.
I hope someone can help.
 
Generally you create a Valid function on the GET field for the Qty. How that Valid function is made part of the screen depends on if you are using the old @GET/SAY screens or the Screen Designer.

If the Screen Designer, you double click on the varible field and a screen will open enabling you to enter a Valid function directly into the screen or a reference to an external function to be executed as the Valid expression.

If the @GET/SAY version, you add a VALID clause to the command.
Example:
@ 10,50 GET m.Qty VALID updtalloc()

And elsewhere (typically in your procedure file) you would define:
FUNCTION UpdtAlloc
m.alloc = m.alloc + m.Qty
SHOW GET m.alloc
RETURN .T.

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
SI ES FOXPRO DOS 2.6 PRUEBA CON SET REFRESH, CONSULTA EN EL HELP DEL FOX

GONDI
 
That sounds nice and simple. Thanks I'll try it tomorrow
 
I just tried and it did not update the allocation qty. Maybe it is because m.alloc is put on the screen with @ say. After a new qty to ship is allocated I want the heading to reflect the new calculation. Perhaps I should just write a function with a new @ say statement to redisplay the new total
 
Click refresh in the m.alloc quantity and use a SHOW GETS instead of SHOW GET m.alloc in the valid function.
 
The SHOW GETS will refresh all screen variables instead of just the single one (look at Foxpro's Help).
And, yes, sometimes it is necessary to use it instead.

Good Luck,

JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top