root/projects/drilltojournalcf/trunk/defn/Records/FU/FUNCLIB_GSDRILL/GS_DRILL_WRK/FieldFormula.pcdefn.peoplecode

Revision 84, 2.8 KB (checked in by larry.grey, 22 months ago)

Completed code by accepting any set of chartfield values as parameters.

Line 
1Declare Function adjust_line_scroll PeopleCode FUNCLIB_GL.JOURNAL_LINE FieldFormula;
2
3Function ApplyDrillCriteria()
4   
5   /* Grey Sparling - Code to drill to row with chartfield values passed in as a parameter */
6   Local Rowset &RS_CFS = GetRowset(Scroll.BU_LED_CF_VW);
7   Local string &sChartField;
8   Local number &sNumParameters = 0;
9   Local boolean &PassedParameters = False;
10   Local array of string &CF_Params;
11   Local array of string &CF_ParamValues;
12   Local number &m;
13   
14   &CF_Params = CreateArray(&sChartField);
15   &CF_ParamValues = CreateArray(&sChartField);
16   
17   /* Grey Sparling - Build Array with all the parameters passed in the Request Object */
18   
19   For &l = 1 To &RS_CFS.ActiveRowCount;
20     
21      &sChartField = &RS_CFS(&l).BU_LED_CF_VW.CHARTFIELD.Value;
22      &CF_ParamValues [&sNumParameters + 1] = %Request.GetParameter(&sChartField);
23     
24      If All(&CF_ParamValues [&sNumParameters + 1]) Then
25         
26         &CF_Params [&sNumParameters + 1] = &sChartField;
27         &PassedParameters = True;
28         &sNumParameters = &sNumParameters + 1;
29         
30      End-If;
31   End-For;
32   
33   /* Grey Sparling - Use the parameters in the array to find the appropriate set of Journal Lines */
34   
35   If &PassedParameters Then
36      If JRNL_HEADER.JRNL_HDR_STATUS = "D" Or
37            JRNL_HEADER.JRNL_HDR_STATUS = "P" Or
38            JRNL_HEADER.JRNL_HDR_STATUS = "U" Then
39         /* Grey Sparling - Journal is read only */
40         
41         /* Grey Sparing - Loop through parameters array and set them in work record for searching */
42         
43         For &m = 1 To &sNumParameters;
44            @("JRNL_PANELS_WRK." | &CF_Params [&m]) = &CF_ParamValues [&m];
45         End-For;
46         
47         REM What does this function do? ;
48         adjust_line_scroll();
49      Else
50         /* Grey Sparling - Journal is editable */
51         Local Rowset &rsJrnlLines = GetLevel0().GetRow(1).GetRowset(Scroll.JRNL_LN);
52         Local number &j;
53         
54         For &j = 1 To &rsJrnlLines.ActiveRowCount
55            Local Row &rowTest = &rsJrnlLines.GetRow(&j);
56            &sFoundCombination = True;
57           
58            /* Grey Sparling - Loop through fields in array to see if current row matches all passed parameters */
59           
60            For &m = 1 To &sNumParameters;
61               If &rowTest.GetRecord(Record.JRNL_LN).GetField(@("Field." | &CF_Params [&m])).Value = &CF_ParamValues [&m] Then
62                  &rowTest.GetRecord(Record.JRNL_LN).GetField(@("Field." | &CF_Params [&m])).SetCursorPos(%Page);
63               Else
64                  &sFoundCombination = False;
65               End-If;
66               
67            End-For;
68           
69            If &sFoundCombination Then
70               Break;
71            End-If;
72           
73         End-For;
74      End-If;
75   End-If;
76   
77End-Function;
78
Note: See TracBrowser for help on using the browser.