Focal Point
Associating a variable with a field in Stack

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

May 14, 2008, 05:18 PM
seadog
Associating a variable with a field in Stack
I am a noobie to Maintain and am looking to capture the curent system date using Today () to a variable and the associate the variable with a field in a stack and then Update the stack back to the db.


WebFOCUS 7.6.4
Windows
May 15, 2008, 03:00 AM
GamP
Personally, I always use today2 to get the system date, because that one also has the century information.
But, because the result of today or today2 is almost never how I need it to be, I always have to manipulate the result to get what I need.
Example:
Compute date/a10 = today2();
Compute h1/a8 = mask(date,'$$$$$$9999') | mask(date,'99') | mask(date,'$$$99'); 
Compute h2/i8yymd = edit(h1);
Compute thisday/yymd = h2;

And after this today's date is available to me in the variable thisday.
This can be used to be stored in stack fields or whatever you wish to do with it.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
May 15, 2008, 08:37 AM
seadog
Thanks for this info. I am still looking for how to move this variable into a text box and then from the text box to a field in the stack.


WebFOCUS 7.6.4
Windows
May 19, 2008, 09:27 AM
Maintain Wizard
Creating variables and moving them on and around a form is very simple.

Let's say you have:
COMPUTE TEST/A10 = 'MAINTAIN';

You can display that on the form in a text box in 2 ways. The first way is to just drag that variable from the Object Explorer onto the form. This creates a field on the form that can be accessed in the code.

The other way is to click on the EditBox object on the Controls Palette and draw the rectangle on the form. Double click on it, and then you can assign the variable to the object.

As for using stacks, it's pretty much the same. You can load fields into a stack:
FOR ALL NEXT MOVIECODE INTO STK
and the drag the stack or individual fields onto the form.

Mark
May 19, 2008, 02:15 PM
seadog
I am successful in associating the date with the edit_field. I am still looking for a code example to move the date into the stack prior to issuing the Update command. I have the FocIndex value captured coming into the code listed below:


acronym_dictionary_master_table.ACRONYM_DICTIONARY_MASTER_TABLE.DATE_LAST_UPDATE = TodayDate
**************************************

Code to associate the date with field in stack.

**************************************

Update
acronym_dictionary_master_table.ACRONYM_DICTIONARY_MASTER_TABLE.DESCRIPTION acronym_dictionary_master_table.ACRONYM_DICTIONARY_MASTER_TABLE.DATE_LAST_UPDATE from listSTK() ;
Commit


WebFOCUS 7.6.4
Windows
May 20, 2008, 02:01 PM
Maintain Wizard
Using the example that you have provided, you would do this:

Compute listSTK.DATE_LAST_UPDATE = TodayDate;
Update fields from listSTK

Mark
May 27, 2008, 08:58 AM
seadog
OK, I am still not successful in getting the date back into my db via the stack. Here is the code, can sanyone shed any light on what I am missing?

Case fnt_update

Compute CNT = listSTK.FocIndex

Compute listSTK.DATE_LAST_UPDATE = TodayDate;


Update acronym_dictionary_master_table.ACRONYM_DICTIONARY_MASTER_TABLE.DESCRIPTION
acronym_dictionary_master_table.ACRONYM_DICTIONARY_MASTER_TABLE.DATE_LAST_UPDATE from listSTK(CNT) ;
Commit

EndCase


WebFOCUS 7.6.4
Windows
May 27, 2008, 10:17 AM
seadog
Maintain Wizard

Janice says you are the resource who can help me with this. Can you contact me directly ?

513-841-7153


WebFOCUS 7.6.4
Windows
May 27, 2008, 03:13 PM
seadog
Maintain Wizard corected issue with syntax listed below:

Module Import(MNTUWS) under MAINTAIN FILE

Compute DateT/HYYMDI = HGETC(20,DateT) under CASE Top

compute stack_name.field_name = DateT under Update Case


WebFOCUS 7.6.4
Windows