Focal Point
[SOLVED] Maintain - reload form data (Case closed)

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9937082976

November 09, 2015, 02:29 PM
George Patton
[SOLVED] Maintain - reload form data (Case closed)
Folks,

I am new to Maintain and have been getting help with a simple question from IBI Tech Support. Mark Derwin has kindly provided me with the following code, which does mostly what I want. However there is one thing I would like improved.

When case saver is invoked the three values are updated just fine, but the form clears all the fields. I want to retain and re-display everything but the pdesc field so my user doesn't have to reselect the salesrep, ccode and dept. They will be updating the values for each product (pdesc) sequentially and reselecting the salesrep, ccode and dept would be exceedingly tedious and confusing. What would be even more wonderful is if the pdesc drop-down box could also remain visible (maybe a list box instead?) so the user could just choose the next product and move right on.

MAINTAIN FILE sales_targets
 
$$Declarations
 
Case Top
perform getreps
Winform Show Form1;
endcase
 
case getreps
reposition salesrep
stack clear stk1 stk1a stk2 stk2a stk3 stk3a stk4 stk4a stk5
infer  salesrep into stk1
For all next salesrep into stk1a
stack copy from stk1a into stk1(2)
EndCase
 
case getcusts
reposition salesrep
stack clear stk2 stk2a stk3 stk3a stk4 stk4a stk5
infer salesrep ccode into stk2
for all next salesrep ccode into stk2a
  where salesrep = stk1().salesrep;
stack copy from stk2a into stk2(2)
endcase
 
case getdep
reposition salesrep
stack clear stk3 stk3a stk4 stk4a stk5
infer salesrep ccode dept into stk3
for all next salesrep ccode dept into stk3a
  where salesrep = stk1().salesrep
  and ccode = stk2().ccode;
stack copy from stk3a into stk3(2)
endcase
 
case getprod
reposition salesrep
stack clear stk4 stk4a stk5
infer salesrep ccode depT pdesc into stk4
for all next salesrep ccode depT pdesc into stk4a
  where salesrep = stk1().salesrep
   and ccode = stk2().ccode 
   and dept = stk3().dept
Stack copy from stk4a into stk4(2)
endcase
 
case showprod
infer salesrep ccode dept pdesc into stk5
stack clear stk5
copy from stk4() into stk5
endcase
 
case saver
update FOBOT pqty unqty from stk5
commit
perform getdep
endcase
 
END

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
November 09, 2015, 03:12 PM
Maintain Wizard
George
To do what you want for this app, after the save, you just have to not reload the other boxes. Also, replacing the fourth combo box with a list box is easy. I have updated the demo and uploaded the files to your case. Let me know.

Mark
November 09, 2015, 03:34 PM
George Patton
Mark,
The display is perfect, but the fobot, pqty and unqty aren't updating correctly now.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
November 09, 2015, 03:48 PM
George Patton
Small correction Mark,
The values are being updated, but the update only shows if the salesrep, ccode or dept is changed and re-selected.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
November 10, 2015, 01:34 PM
George Patton
Here's the solution - thanks Mark!

.
.
.
.

case getprod
reposition salesrep
stack clear stk4 stk4a stk5
infer salesrep ccode depT pdesc into stk4
for all next salesrep ccode depT pdesc into stk4a
  where salesrep = stk1().salesrep
   and ccode = stk2().ccode
   and dept = stk3().dept
stack copy from stk4a into stk4(2)
endcase
 
case showprod
infer salesrep ccode dept pdesc into stk5
stack clear stk5
copy from stk4() into stk5
endcase
 
case saver
update FOBOT pqty unqty from stk5
commit
Compute MSG/a50 = "Product " | stk5.pdesc || " has been updated."
Perform getprod;
winform set form1.listbox1.focus to here;
endcase
 
END



WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP