forked from patrickTingen/DataDigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
myDataDigger.txt
212 lines (182 loc) · 9.42 KB
/
myDataDigger.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*************************************************************************
File : myDataDigger.p
Purpose : Customized routines for DataDigger.
WARNING: This .txt file is for documentation purposes.
It will be overwritten with each new version of DataDigger.
Create your own custom procedure by copying this program to
"myDataDigger.p". It will then be compiled and started when DD
starts. In future versions of the DataDigger, myDataDigger.p
will not be overwritten.
HISTORY: DD18: customFilter added.
DD18: customDump moved here instead of having its own .p
DD20: customShowField added
DD21: customSaveFilterValue / customGetFilterValue added, customFilter removed
*************************************************************************/
/* All functions of DataDigger, see DataDiggerLib for a full list */
{datadigger.i}
/* [QAD]
define new global shared variable global_domain as character.
*/
PROCEDURE customShowField:
/*
* Name: customShowField
* Desc: Change the visibility for a field
*
* This hook enables you to change the default visibility of a field.
*
* This is handy if you have some fields in your database that
* you never want to select, for example fields that have been added by
* your framework to all tables but which do not hold value for you.
*
* Note that this is just the default visibility. During run-time you
* can always change the visibility.
*/
DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcTable AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcField AS CHARACTER NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER plShow AS LOGICAL NO-UNDO INITIAL TRUE.
/* Example, hide the cust-num field except on the customer table
IF pcField = 'cust-num' AND pcTable <> 'customer' THEN plShow = FALSE.
*/
END PROCEDURE. /* customShowField */
PROCEDURE customFormat:
/*
* Name: customFormat
* Desc: Change the format for a field
*
* Depending on the input parameters you are able to adjust
* the format of a field. This routine is called after the
* custom format is fetched from the user settings.
*
* This is handy if - for example - all userid fields in your
* database have the wrong format. Or if you want to show
* all decimal fields with 4 decimals instead of 3.
*/
DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcTable AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcField AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcDatatype AS CHARACTER NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER pcFormat AS CHARACTER NO-UNDO.
/* Example code: set minus sign at the front of an decimal field */
/* IF pcDataType = "DECIMAL" */
/* AND NOT pcFormat BEGINS "-" THEN pcFormat = "-" + pcFormat. */
END PROCEDURE. /* customFormat */
PROCEDURE CustomDump:
/*
* Name: customDump.p
* Desc: Customized dump data from DataDigger
*
* DataDigger will call this file with the following parameters:
*
* input pcAction (character) - type of dump (Delete | Save)
* input pcDatabase (character) - name of the database
* input pcTable (character) - name of the table
* input phData (handle ) - handle to a dynamic tt with the data to dump
* input pcFilename (character) - filename as suggested by DataDigger
*
* The phData parameter is a handle to a temp-table that holds only the
* data you would like to dump. So it contains 1 record in case of a save
* action and 1 or more in case of a delete action.
*
* You can give these parameters back to DataDigger:
*
* output pcMessage (character) - a message to show the user
* output plDefaultDump (logical ) - perform regular DD dump or not
* output plContinue (logical ) - perform regular DD dump or not
*
* pcMessage:
* This can be an informative message, a warning or an error. This
* will be shown to the user by DataDigger.
*
* plDefaultDump
* This tells DD whether to perform its own dump or not.
*
* plContinue
* This tells DD whether the action should be committed. You
* can use this to prevent certain delete or save actions.
*
*
* Note that if you do your own dump, using the filename DD suggests in pcFilename
* and you set plDefaultDump to TRUE, DD will overwrite your file because it too
* uses this filename to dump its data.
*
*/
DEFINE INPUT PARAMETER pcAction AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcTable AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER phData AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER pcFilename AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER pcMessage AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER plDefaultDump AS LOGICAL NO-UNDO.
DEFINE OUTPUT PARAMETER plContinue AS LOGICAL NO-UNDO.
/* Example code: ask if user is really sure to delete */
/* IF pcAction = 'Delete' THEN */
/* DO: */
/* MESSAGE 'Are you really really really sure you want to delete these precious records?' */
/* VIEW-AS ALERT-BOX INFO BUTTONS YES-NO UPDATE plContinue. */
/* END. */
/* */
/* ELSE */
/* DO: */
/* /* This will export your data just like DataDigger does */ */
/* phData:WRITE-XML */
/* ( 'file' /* TargetType */ */
/* , pcFileName /* File */ */
/* , YES /* Formatted */ */
/* , ? /* Encoding */ */
/* , ? /* SchemaLocation */ */
/* , NO /* WriteSchema */ */
/* , NO /* MinSchema */ */
/* ). */
/* ASSIGN plContinue = TRUE. */
/* END. */
END PROCEDURE. /* CustomDump */
PROCEDURE customQuery:
/*
* Name: customQuery.p
* Desc: Adjust query string
*
* This routine is called when DataDigger places a query in the WHERE-editor
* and when you select a table. In that case the query is empty. In all
* cases this routine is called just prior to placing the text in the query
* editor. This gives you a chance to alter the query.
*
* INPUT pcDatabase (character) - name of the database
* INPUT pcTable (character) - name of the table
* INPUT-OUTPUT pcQuery (character) - your query string
*
*/
DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcTable AS CHARACTER NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER pcQuery AS CHARACTER NO-UNDO.
/* Example code: get the most recently used query from query history */
/* IF pcQuery = "" THEN */
/* pcQuery = DYNAMIC-FUNCTION("getQuery", pcDatabase, pcTable, 1). */
END PROCEDURE. /* customQuery */
PROCEDURE customGetFilterValue:
/*
* Name: customGetFilterValue
* Desc: After the data browse is created, the filter fields
* are created one by one. You can use this routine to
* give them a default value.
*/
DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcTable AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcField AS CHARACTER NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER pcFilterValue AS CHARACTER NO-UNDO.
/* Example code: set a particular field to a specific value */
/* IF pcField MATCHES "*_domain" THEN pcFilterValue = global_domain. */
END PROCEDURE. /* customGetFilterValue */
PROCEDURE customSaveFilterValue:
/*
* Name: customSaveFilterValue
* Desc: Perform actions based on the value of a filter
*
*/
DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcTable AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcField AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcFilterValue AS CHARACTER NO-UNDO.
/* Example code: save value of a particular field */
/* IF pcField MATCHES "*_domain" THEN global_domain = pcFilterValue. */
END PROCEDURE. /* customSaveFilterValue */