ASNA WingsRPG™ Reference Manual |
Adding a Field to a Display File
This is a walkthrough for adding an additional field to a Display File. The example used is one that will add the contact name to an order inquiry display.
Open ASPX display file in Visual Studio
The first step is to open the ASPX file in the Design view to determine the position of the new field. The following image of the Design view shows the desired placement of the constant and data field shown in the black rectangles with the content shown in red.
Making it easier
The next step will be to select the toolbox on the far right and select web controls from the toolbox and drag and drop them onto the form. However, moving fields within the form in Visual Studio is not a user friendly process. To make it easier you may want to first make a note of the position of other surrounding constants and data fields for the location of the new controls.
In this instance, look at the LEFT position of the Status...: constant and note it is 19px. Now note the VirtualRowCol of the activity status (SFLC_CMACTIVE), which is 6,12, but you will only need the column (12). Next, note the TOP position of the SFLC_CMSTATE control: 144px. On that same control note the VirtualRowCol, which is 7,45, but you will only need the row (7).
Drag and drop DdsConstant to display file
Now drag and drop the DdsConstant control onto the form using the split view. The result in the Source will resemble the following.
<mdf:DdsConstant id="DdsConstant31" runat="server" />
Find and move this code to the correct position within the record, which follows the SFLC_CMCITY control in the Source. Now the positioning can be manually added using the LEFT position noted from the Status constant (19px) and the TOP position from SFLC_CMSTATE (144px) like the following example.
<mdf:DdsConstant id="DdsConstant31" runat="server" style=" POSITION: absolute; LEFT: 19px; TOP: 144px;" />
View the properties window and set the text property value to "Contact:" (minus the quotes) and select DdsConstant as the CssClass. The final control in Source will appear similar to the following.
<mdf:DdsConstant id="DdsConstant31" runat="server" style=" POSITION: absolute; LEFT: 19px; TOP: 144px;" Text="Contact:" CssClass="DdsConstant" />
Drag and drop DdsCharField to display file
Next select a DdsCharField control from the toolbox and drag and drop the control onto the form. It will resemble the following in the Source.
<mdf:DdsCharField id="DdsCharField1" runat="server" />
Now move this control into the record following the Contact constant and begin to set the properties needed to display the contact data. The table that follows shows the properties and sample content.
Property | Content |
---|---|
ID This is the field name used as the reference within the display file. Make sure the name is unique. |
SFLC_CMCONTACT |
Alias This is the field name as it will be referenced in the RPG program, which must also be unique. |
CMCONTACT |
CssClass This is the CssClass identification field indicating the ASNA Monarch class for the control. |
DdsCharField |
Length This is the length of the control field. |
20 |
Usage This is how the field will be used; Hidden, InputOnly, OutputOnly, or Both (input and output). Select OutputOnly since it is a displayed field only. |
OutputOnly |
VirtualRowCol This is the required virtual row and column in which this control is displayed in the RPG program. Note that Row 7 is taken from the State row and the column is taken from the activity Status. |
7,12 |
Once the properties are set, the Source will resemble the following.
<mdf:DdsConstant id="SLFC_CMCONTACT" runat="server" CssClass="DdsCharField" Length="20" style=" POSITION: absolute; LEFT: 109px; TOP: 144px; width: 278px;" Alias="CMCONTACT" Usage="OutputOnly" VirtualRowCol="7,12" />
The finished display file in the Design view will resemble the image below which shows the SFLC_CMCONTACT field selected.
Export DDS to Display File
The next step is to export the DDS to the IBM i library that holds the "handler" programs. This process is called Exporting a Display File, process that can be run manually by the Wings developer or through Flight Plans. This step is necessary since the RPG Program expects the data for Workstation records that are written or read, to be of a specific type and in order as described by the IBM i Display file used during compilation.
When the Display File's DDS source member is imported, the (X)HTML markup generated matches the different records, in the same order and type as those in the original DDS. If the ASPX Page's (X)HTML markup is modified by the user to further modernize the application as in this example, the IBM i Display file needs to be updated and the RPG program needs to be re-compiled to make sure the record definition expected by the RPG program matches the changes on the Display file.
The exported display file will resemble the following. Note the additional CMCONTACT field positioned in row 7, column 12.
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions++++++++++ 0001.00 A DSPSIZ(27 132 *DS4) 0011.00 A INDARA 0021.00 A R ORDHREC 0031.00 A OVERLAY 0041.00 A RTNCSRLOC(&CSRREC &CSRFLD) 0051.00 A CSRREC 10A H 0061.00 A CSRFLD 10A H 0071.00 A DTORDNUM 9 0O 1 19 0081.00 A DTORDDATE L B 2 19DATFMT(*ISO) 0091.00 A DTSHPDATE L B 3 19DATFMT(*ISO) 0101.00 A DTDELDATE 8 0B 4 19 0111.00 A DTSHPVIA 3 0B 5 19 0121.00 A DTWEIGHT 18 O 6 19 0131.00 A R KEYS 0141.00 A R MYWINDOW 0151.00 A OVERLAY 0161.00 A WINTITLE 22A H 0171.00 A R SFL1 SFL 0181.00 A SFCOLOR 1 B 12 2 0191.00 A SFSEL 2 0B 12 4 0201.00 A SFORDNUM 9 0O 12 7 0211.00 A SFORDDATE L O 12 19DATFMT(*ISO) 0221.00 A SFSHPDATE L O 12 32DATFMT(*ISO) 0231.00 A SFDELDATE 8 0O 12 44 0241.00 A SFORDAMT 13 4O 12 56 0251.00 A SFFILESTAT 18 O 12 57 0261.00 A SFSHPVIA 3 0O 12 76 0271.00 A R SFLC SFLCTL(SFL1) 0281.00 A SFLSIZ(10) 0291.00 A SFLPAG(10) 0301.00 A N90 SFLDSP 0311.00 A N90 SFLDSPCTL 0321.00 A 90 SFLCLR 0331.00 A OVERLAY 0341.00 A SCRCUST 50 O 3 12 0351.00 A SCRPHONE 20 O 4 12 0361.00 A CMADDR1 35 O 4 45 0371.00 A SCRFAX 14 O 5 12 0381.00 A CMADDR2 35 O 5 45 0391.00 A CMACTIVE 1 O 6 12 0401.00 A CMCITY 30 O 6 45 0411.00 A CMSTATE 2 O 7 45 0411.50 A CMCONTACT 20 O 7 12 0421.00 A CMPOSTCODE 10 O 7 48 0431.00 A SETORDNUM 9 0B 9 69 0441.00 A R MSGSF SFL 0451.00 A SFLMSGRCD(24) 0461.00 A @MSGKY SFLMSGKEY 0471.00 A @PGMQ SFLPGMQ 0481.00 A R MSGSFC SFLCTL(MSGSF) 0491.00 A SFLSIZ(10) 0501.00 A SFLPAG(1) 0511.00 A SFLDSP 0521.00 A SFLDSPCTL 0531.00 A SFLINZ 0541.00 A @PGMQ SFLPGMQ 0551.00 A R IASNAWINGS 0561.00 A 01 02 03 0571.00 A 04 05 06 0581.00 A 07 08 09 CA01 0591.00 A 10 11 12 0601.00 A 13 14 15 0611.00 A 16 17 18 CA02 0621.00 A 19 20 21 0631.00 A 22 23 24 0641.00 A 25 26 27 CA03 0651.00 A 28 29 30 0661.00 A 31 32 33 0671.00 A 34 35 36 CA04 0681.00 A 37 38 39 0691.00 A 40 41 42 0701.00 A 43 44 45 CA05 0711.00 A 46 47 48 0721.00 A 49 50 51 0731.00 A 52 53 54 CA06 0741.00 A 55 56 57 0751.00 A 58 59 60 0761.00 A 61 62 63 CA07 0771.00 A 64 65 66 0781.00 A 67 68 69 0791.00 A 70 71 72 CA08 0801.00 A 73 74 75 0811.00 A 76 77 78 0821.00 A 79 80 81 CA09 0831.00 A 82 83 84 0841.00 A 85 86 87 0851.00 A 88 89 90 CA10 0861.00 A 91 92 93 0871.00 A 94 95 96 0881.00 A 97 98 99 CA11
Change and Recompile RPG Program
Before recompiling the program, the source field in the data table for the contact name must be added so the contact name will be displayed. Once that additional change is made, the program can be recompiled.