# Functions DataEase 8.5

```Functions DataEase 8.5
ver. 1767
Function::Mathematical
Abs (absolute value)
Usage:
abs(NUMERIC VALUE) abs(-1232) abs(0.323) abs(MySumField*YourSumfield)
Purpose:
The abs function converts a numeric value to a positive, unsigned numeric value.
Return value:
Positive Numeric Value 0 to +n
Content:
abs (absolute value)
Type
Math Function
Purpose
The abs function converts a numeric value to a positive, unsigned numeric value.
Syntax
abs( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Math function can be a constant value (as shown below), a variable, a field value or an expression.
The abs function can only be used with a numeric value. A non-numeric value always returns a value of 0.
Examples
abs( -453)
Returns: 453
abs( 4.53)
Returns: 4.53
Examples:
Example 1
abs(-8)
Result: 8
Example 2
abs(8)
Result: 8
Example 3
Alternative DataEase derivation that will give same result:
if (Field<0,Field*-1,Field)
Se Also:
Function::Action
AccessNoRecord
Usage:
AcsessNoRecord () variable :=AcsessNoRecord ()
Purpose:
Set locking to read record access.
Return value:
Status (Integer)
Content:
Allow No Records to be Accessed by other users.
Examples:
Se Also:
Function::Action
Usage:
Purpose:
Set locking to read record access
Return value:
Status (Integer)
Content:
Allow other users to Read all Records.
Examples:
Se Also:
Function::Mathematical
Acos (arccosine)
Usage:
acos(field) acos(numeric value) acos(-1) acos(0.5) acos(myvalue+yourvalue*theirvalue)
Purpose:
The acos function calculates the arccosine of a numeric value. The result is an angle expressed in radians between 0 and p.
Return value:
Numeric value.
Content:
acos (arccosine)
Type
Trigonometric Function
Purpose
The acos function calculates the arccosine of a numeric value. The result is an angle expressed in radians between 0 and p.
Syntax
acos( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value or an expression.
The valid range of the input value is -1 to 1
Examples
acos( 0.5)
Returns: 1.047195755
acos( -0.8)
Returns: 2.49809154
Examples:
Example 1
acos(0.5)
Result: 1.047195755
Example 2
acos(-0.8)
Result: 2.49809154
Se Also:
Function::DateTime
AmPm
Usage:
ampm(TimeField) ampm(08:15:22)
Purpose:
The ampm functione valuates avalue expressed in the 24-hour time format (HH:MM:SS) and returns the appropriate abbreviation AM (before noon), or PM (after noon).
Return value:
A fixed string AM or PM.
Content:
ampm
Type
Time Function
Purpose
The ampmfunctionevaluates avalueexpressed in the 24-hour time format (HH:MM:SS) and returns the appropriate abbreviation AM (before noon), or PM (after noon).
Syntax
ampm(TIME VALUE)
Returns:
A textvalue(either AM or PM).
Usage:
Timevaluesfrom midnight (00:00:00) to (11:59:59) return AM. Timevaluesfrom noon (12:00:00) to (23:59:59) return PM.
Examples:
ampm(08:15:25)
Returns:AM
ampm(15:30:50)
Returns:PM
Examples:
Example 1
ampm(16:12:33)
Result: PM
Example 2
ampm(01:22:43)
Result: AM
Se Also:
TimeAmPm
Function::Action
ApplicationClose
Usage:
ApplicationClose () retval := ApplicationClose () .
Purpose:
Closes the current application.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Mathematical
Asin (arcsine)
Usage:
asin(numeric field) asin(numeric value) asin(-1) asin(0.5)
Purpose:
The asin function calculates the arcsine of a numeric value. The result is an angle expressed in radians between -p/2 to p/2.
Return value:
A numeric value
Content:
asin (arcsine)
Type
Trigonometric Function
Purpose
The asin function calculates the arcsine of a numeric value. The result is an angle expressed in radians between -p/2 to p/2.
Syntax
asin( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value or an expression.
The valid range of the input value is -1 to 1.
Example
asin(1)
Returns:1.570796
asin(-0.50)
Returns: -0.5235988
Examples:
Example 1
asin(1)
Result:1.570796
Example 2
asin(-0.50)
Result: -0.5235988
Se Also:
Acos (arccosine) Atan (arctangent) Atan2 (arctangent 2)
Function::Mathematical
Atan (arctangent)
Usage:
atan(field) atan(numeric value) atan(500.32) atan(-332.43) atan(myvalue+yourvalue)
Purpose:
The atan function calculates the arctangent of a numeric value. The result is an angle expressed in radians between -p/2 to p/2.
Return value:
Numeric Value
Content:
atan (arctangent)
Type
Trigonometric Function
Purpose
The atanfunctioncalculates the arctangent of a numericvalue. The result is an angle expressed in radians between -p/2 to p/2.
Syntax
atan(NUMERIC VALUE)
Returns
A numericvalue.
Usage
The numericvaluein a Trigonometricfunctioncan be aconstantvalue(as shown below), avariable, a fieldvalueor an expression.
Examples
atan(500.3)
Returns:1.56879753
atan(-359.4)
Returns:-1.5680139
Examples:
Example 1
atan(500.3)
Returns: 1.56879753
Example2
atan(-359.4)
Returns: -1.5680139
Se Also:
Atan2 Asin (arcsine) Acos (arccosine)
Function::Mathematical
Atan2 (arctangent 2)
Usage:
atan2(numerical field,numerical field) atan2(numerical value,numerical value) atam2(numerical field,numerical value) atan2(field,33) atan2(lookup relation field, 3)
Purpose:
The atan2 function calculates the arctangent of Value 1 divided by Value 2
The result is an angle expressed in radians between -p and p.
Return value:
Numerical value
Content:
atan2 (arctangent 2)
Type
Trigonometric Function
Purpose
The atan2 function calculates the arctangent of Value 1 divided by Value 2
The result is an angle expressed in radians between -p and p.
Syntax
atan2( NUMERIC VALUE 1, NUMERIC VALUE 2)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value or an expression.
Examples
atan2(3,127)
Returns:0.02361766
atan2(1, 1)
Returns:0.7854
Examples:
Example 1
atan2(3,127)
Returns:0.02361766
Example 2
atan2(1, 1)
Returns:0.7854
Se Also:
Atan Asin (arcsine) Acos (arccosine)
Function::Mathematical
Ceil
Usage:
ceil(numerical field) ceil(numerical value) ceil(3.42232) ceil(-4.3232) ceil(myvalue*yourvalue)
Purpose:
The ceil function rounds up a numeric value to the next integer. The opposite function is Floor.
Return value:
Numeric value. Integer
Content:
ceil
Type
Math Function
Purpose
The ceil function rounds up a numeric value to the next integer.
Syntax
ceil( NUMERIC VALUE)
Returns
An integer value.
Usage
The numeric value in a Math function can be a constant value (as shown below), a variable, a field value or an expression.
Examples
ceil(5.000)
Returns:5
ceil(5.001)
Returns:6
Examples:
Example 1
ceil(4.5)
Result: 5
Example 2
ceil(4.0)
Result: 4
Example 3
We use a field in this example called MyField and our goal is to get the function to round up if the decimal value is larger than x.5 and down if it smaller than x.5
ceil(MyField-0.5)
For MyField= 4.51 {ceil(4.01)}
Result: 5
For MyField= 4.49 {ceil(3.99)}
Result: 4
Se Also:
Floor
Function::String
Chr
Usage:
chr(numerical field) chr(numerical value) chr(34) chr(MyValue+YourValue)
Purpose:
This simple function will return the corresponding ASCII character for any numerical value. It is to be used in combination with concat(), MemoCopy(), MemoMemoCopy(),
MemoReplace(), MemoFind() etc.
It is a very useful function for building advanced strings or documents.
To find the value of any character use this website: http://asciivalue.com/index.php
Return value:
Character - String(1)
Content:
We continue to extend the function library in 8, and one functions that has been missing for "ever", has been CHR.
It might be a programmers function, but after we introduced the new exciting Memo manipulation class the lack of this function become even more evident.
The problem most DataEase people have experienced, might be the one where you have to include a " in your string... """...no!
Stop wondering any longer, now it is simply chr(34) ex. concat(chr(34),"Mr. DataEase",chr(34) will return "Mr.DataEase".
Our problem was even more annoying. One of the most important new functions in the Memo Manipulation library is MemoCopy where you can for instance Append a
String/Number etc to a Memo. Lovely, but to make it look good, you might also want to have the new value start on a new line...not so easy in traditional DataEase.
Now there is.
Simply use the function MemoAppend(MemoToAppend,chr(13),0) for a simple carriage return, or MemoAppend(MemoToAppend,concat(chr(13),FieldToAppend),0) to get the
value on a new line.
The rest we leave to your imagination.
Examples:
Example 1
We want quotes around part of the default value in a Field. Quotes is what define a text string in DataEase derivation and programming so we can't use them direct.
This will result in everything after the second quote will be ignored.
This on the other hand will give us the wanted result. ASCII value 34 equals ".
Example 2
When building multi-line fields like Memo etc, we very often want to add a Carriage Return or New Line.
Up to now, this has been very difficult if not impossible to do in DataEase. This has now changed.
In DataEase Memo a proper New Line is both CR and NL... So you need to add chr(13)+chr(10).
We use an example from MemoCopy().
This example will be a little more practical. Let say we want to insert a new sentence at the beginning i.e a heading. We will combine MemoCopy() with another new function
chr() which will allow you to append any ASCII value as well like CR or ".
MemoCopy(MyMemo,concat("This is the results of the Norwegian Jury!",chr(13),chr(10)),3)+MemoCopy(MyMemo,"Peter Griffin",0)
Result:
The Result of the Norwegian Jury!
And the winner is Peter Griffin.
We see here that we get a carriage return after the new heading. This can be very useful when you are going to build documents etc in Memo fields or diretctly in Text fields
with WriteToFile() etc.
Reference
ASCII control characters (character code 0-31)
The first 32 characters in the ASCII-table are unprintable control codes and are used to control peripherals such as printers.
DEC OCT HEX BIN
0
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
000
001
002
003
004
005
006
007
010
011
012
013
014
015
016
017
020
021
022
023
024
025
026
027
030
031
032
033
034
035
036
037
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
Symbol HTML Number HTML Name
00000000 NUL
00000001 SOH
00000010 STX
00000011 ETX
00000100 EOT
00000101 ENQ
00000110 ACK
00000111 BEL
00001000 BS
00001001 HT
00001010 LF
00001011 VT
00001100 FF
00001101 CR
00001110 SO
00001111 SI
00010000 DLE
00010001 DC1
00010010 DC2
00010011 DC3
00010100 DC4
00010101 NAK
00010110 SYN
00010111 ETB
00011000 CAN
00011001 EM
00011010 SUB
00011011 ESC
00011100 FS
00011101 GS
00011110 RS
00011111 US
&#000;
&#001;
&#002;
&#003;
&#004;
&#005;
&#006;
&#007;
&#008;
&#009;
&#010;
&#011;
&#012;
&#013;
&#014;
&#015;
&#016;
&#017;
&#018;
&#019;
&#020;
&#021;
&#022;
&#023;
&#024;
&#025;
&#026;
&#027;
&#028;
&#029;
&#030;
&#031;
Description
Null char
Start of Text
End of Text
End of Transmission
Enquiry
Acknowledgment
Bell
Back Space
Horizontal Tab
Line Feed
Vertical Tab
Form Feed
Carriage Return
Shift Out / X-On
Shift In / X-Off
Data Line Escape
Device Control 1 (oft. XON)
Device Control 2
Device Control 3 (oft. XOFF)
Device Control 4
Negative Acknowledgement
Synchronous Idle
End of Transmit Block
Cancel
End of Medium
Substitute
Escape
File Separator
Group Separator
Record Separator
Unit Separator
ASCII printable characters (character code 32-127)
Codes 32-127 are common for all the different variations of the ASCII table, they are called printable characters, represent letters, digits, punctuation marks, and a few
miscellaneous symbols. You will find almost every character on your keyboard. Character 127 represents the command DEL.
DEC OCT HEX BIN
32
33
34
35
36
37
38
39
40
41
42
040
041
042
043
044
045
046
047
050
051
052
20
21
22
23
24
25
26
27
28
29
2A
Symbol HTML Number HTML Name
00100000 &#32;
00100001 !
00100010 "
00100011 #
00100100 \$
00100101 %
00100110 &
00100111 '
00101000 (
00101001 )
00101010 *
Space
&#33;
&#34;
&#35;
\$
&#37;
&#38;
&#39;
&#40;
&#41;
&#42;
Description
Exclamation mark
&quot;
Double quotes (or speech marks)
Number
Dollar
Procenttecken
&amp;
Ampersand
Single quote
Open parenthesis (or open bracket)
Close parenthesis (or close bracket)
Asterisk
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
053
054
055
056
057
060
061
062
063
064
065
066
067
070
071
072
073
074
075
076
077
100
101
102
103
104
105
106
107
110
111
112
113
114
115
116
117
120
121
122
123
124
125
126
127
130
131
132
133
134
135
136
137
140
141
142
143
144
145
146
2B
2C
2D
2E
2F
30
31
32
33
34
35
36
37
38
39
3A
3B
3C
3D
3E
3F
40
41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F
50
51
52
53
54
55
56
57
58
59
5A
5B
5C
5D
5E
5F
60
61
62
63
64
65
66
00101011 +
00101100 ,
00101101 00101110 .
00101111 /
00110000 0
00110001 1
00110010 2
00110011 3
00110100 4
00110101 5
00110110 6
00110111 7
00111000 8
00111001 9
00111010 :
00111011 ;
00111100 <
00111101 =
00111110 >
00111111 ?
01000000 @
01000001 A
01000010 B
01000011 C
01000100 D
01000101 E
01000110 F
01000111 G
01001000 H
01001001 I
01001010 J
01001011 K
01001100 L
01001101 M
01001110 N
01001111 O
01010000 P
01010001 Q
01010010 R
01010011 S
01010100 T
01010101 U
01010110 V
01010111 W
01011000 X
01011001 Y
01011010 Z
01011011 [
01011100 \
01011101 ]
01011110 ^
01011111 _
01100000 `
01100001 a
01100010 b
01100011 c
01100100 d
01100101 e
01100110 f
&#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;
Plus
Comma
Hyphen
Period, dot or full stop
Slash or divide
Zero
One
Two
Three
Four
Five
Six
Seven
Eight
Nine
Colon
Semicolon
&lt;
Equals
&gt;
Question mark
At symbol
Uppercase A
Uppercase B
Uppercase C
Uppercase D
Uppercase E
Uppercase F
Uppercase G
Uppercase H
Uppercase I
Uppercase J
Uppercase K
Uppercase L
Uppercase M
Uppercase N
Uppercase O
Uppercase P
Uppercase Q
Uppercase R
Uppercase S
Uppercase T
Uppercase U
Uppercase V
Uppercase W
Uppercase X
Uppercase Y
Uppercase Z
Opening bracket
Backslash
Closing bracket
Caret - circumflex
Underscore
Grave accent
Lowercase a
Lowercase b
Lowercase c
Lowercase d
Lowercase e
Lowercase f
Less than (or open angled bracket)
Greater than (or close angled bracket)
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
147
150
151
152
153
154
155
156
157
160
161
162
163
164
165
166
167
170
171
172
173
174
175
176
177
67
68
69
6A
6B
6C
6D
6E
6F
70
71
72
73
74
75
76
77
78
79
7A
7B
7C
7D
7E
7F
01100111 g
01101000 h
01101001 i
01101010 j
01101011 k
01101100 l
01101101 m
01101110 n
01101111 o
01110000 p
01110001 q
01110010 r
01110011 s
01110100 t
01110101 u
01110110 v
01110111 w
01111000 x
01111001 y
01111010 z
01111011 {
01111100 |
01111101 }
01111110 ~
01111111 &#127;
&#103;
&#104;
&#105;
&#106;
&#107;
&#108;
&#109;
&#110;
&#111;
&#112;
&#113;
&#114;
&#115;
&#116;
&#117;
&#118;
&#119;
&#120;
&#121;
&#122;
&#123;
&#124;
&#125;
&#126;
Delete
Lowercase g
Lowercase h
Lowercase i
Lowercase j
Lowercase k
Lowercase l
Lowercase m
Lowercase n
Lowercase o
Lowercase p
Lowercase q
Lowercase r
Lowercase s
Lowercase t
Lowercase u
Lowercase v
Lowercase w
Lowercase x
Lowercase y
Lowercase z
Opening brace
Vertical bar
Closing brace
Equivalency sign - tilde
The extended ASCII codes (character code 128-255)
There are several different variations of the 8-bit ASCII table. The table below is according to ISO 8859-1, also called ISO Latin-1. Codes 129-159 contain the Microsoft®
Windows Latin-1 extended characters.
DEC OCT HEX BIN
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
200
201
202
203
204
205
206
207
210
211
212
213
214
215
216
217
220
221
222
223
224
225
226
227
230
231
232
233
234
235
80
81
82
83
84
85
86
87
88
89
8A
8B
8C
8D
8E
8F
90
91
92
93
94
95
96
97
98
99
9A
9B
9C
9D
Symbol HTML Number HTML Name
10000000 ?
10000001
10000010 ?
10000011 ?
10000100 ?
10000101 ?
10000110 ?
10000111 ?
10001000 ?
10001001 ?
10001010 ?
10001011 ?
10001100 ?
10001101
10001110 ?
10001111
10010000
10010001 ?
10010010 ?
10010011 ?
10010100 ?
10010101 ?
10010110 ?
10010111 ?
10011000 ?
10011001 ?
10011010 ?
10011011 ?
10011100 ?
10011101
Description
&#128;
&euro;
Euro sign
&#130;
&#131;
&#132;
&#133;
&#134;
&#135;
&#136;
&#137;
&#138;
&#139;
&#140;
&sbquo;
&fnof;
&bdquo;
&hellip;
&dagger;
&Dagger;
&circ;
&permil;
&Scaron;
&lsaquo;
&OElig;
Single low-9 quotation mark
Latin small letter f with hook
Double low-9 quotation mark
Horizontal ellipsis
Dagger
Double dagger
Modifier letter circumflex accent
Per mille sign
Latin capital letter S with caron
Single left-pointing angle quotation
Latin capital ligature OE
&#142;
Latin captial letter Z with caron
&#145;
&#146;
&#147;
&#148;
&#149;
&#150;
&#151;
&#152;
&#153;
&#154;
&#155;
&#156;
&lsquo;
&rsquo;
&ldquo;
&rdquo;
&bull;
&ndash;
&mdash;
&tilde;
&scaron;
&rsaquo;
&oelig;
Left single quotation mark
Right single quotation mark
Left double quotation mark
Right double quotation mark
Bullet
En dash
Em dash
Small tilde
Latin small letter S with caron
Single right-pointing angle quotation mark
Latin small ligature oe
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
213
214
215
216
217
236
237
240
241
242
243
244
245
246
247
250
251
252
253
254
255
256
257
260
261
262
263
264
265
266
267
270
271
272
273
274
275
276
277
300
301
302
303
304
305
306
307
310
311
312
313
314
315
316
317
320
321
322
323
324
325
326
327
330
331
9E
9F
A0
A1
A2
A3
A4
A5
A6
A7
A8
A9
AA
AB
AC
AE
AF
B0
B1
B2
B3
B4
B5
B6
B7
B8
B9
BA
BB
BC
BD
BE
BF
C0
C1
C2
C3
C4
C5
C6
C7
C8
C9
CA
CB
CC
CD
CE
CF
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
10011110 ?
10011111 ?
10100000 &#160;
10100001 ¡
10100010 ¢
10100011 £
10100100 ¤
10100101 ¥
10100110 ¦
10100111 §
10101000 ¨
10101010 ª
10101011 «
10101100 ¬
10101101 &#173;
10101110 ®
10101111 ¯
10110000 °
10110001 ±
10110010 ²
10110011 ³
10110100 ´
10110101 µ
10110110 ¶
10110111 ·
10111000 ¸
10111001 ¹
10111010 º
10111011 »
10111100 ¼
10111101 ½
10111110 ¾
10111111 ¿
11000000 À
11000001 Á
11000010 Â
11000011 Ã
11000100 Ä
11000101 Å
11000110 Æ
11000111 Ç
11001000 È
11001001 É
11001010 Ê
11001011 Ë
11001100 Ì
11001101 Í
11001110 Î
11001111 Ï
11010000 Ð
11010001 Ñ
11010010 Ò
11010011 Ó
11010100 Ô
11010101 Õ
11010110 Ö
11010111 ×
11011000 Ø
11011001 Ù
&#158;
&#159;
&nbsp;
&#161;
&#162;
&#163;
&#164;
&#165;
&#166;
&#167;
&#168;
&#169;
&#170;
&#171;
&#172;
&shy;
&#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;
&#213;
&#214;
&#215;
&#216;
&#217;
Latin small letter z with caron
&yuml;
Non-breaking space
&iexcl;
&cent;
&pound;
&curren;
&yen;
&brvbar;
&sect;
&uml;
&copy;
&ordf;
&laquo;
&not;
Soft hyphen
&reg;
&macr;
&deg;
&plusmn;
&sup2;
&sup3;
&acute;
&micro;
&para;
&middot;
&cedil;
&sup1;
&ordm;
&raquo;
&frac14;
&frac12;
&frac34;
&iquest;
&Agrave;
&Aacute;
&Acirc;
&Atilde;
&Auml;
&Aring;
&AElig;
&Ccedil;
&Egrave;
&Eacute;
&Ecirc;
&Euml;
&Igrave;
&Iacute;
&Icirc;
&Iuml;
&ETH;
&Ntilde;
&Ograve;
&Oacute;
&Ocirc;
&Otilde;
&Ouml;
&times;
&Oslash;
&Ugrave;
Latin capital letter Y with diaeresis
Inverted exclamation mark
Cent sign
Pound sign
Currency sign
Yen sign
Pipe, Broken vertical bar
Section sign
Spacing diaeresis - umlaut
Feminine ordinal indicator
Left double angle quotes
Not sign
Spacing macron - overline
Degree sign
Plus-or-minus sign
Superscript two - squared
Superscript three - cubed
Acute accent - spacing acute
Micro sign
Pilcrow sign - paragraph sign
Middle dot - Georgian comma
Spacing cedilla
Superscript one
Masculine ordinal indicator
Right double angle quotes
Fraction one quarter
Fraction one half
Fraction three quarters
Inverted question mark
Latin capital letter A with grave
Latin capital letter A with acute
Latin capital letter A with circumflex
Latin capital letter A with tilde
Latin capital letter A with diaeresis
Latin capital letter A with ring above
Latin capital letter AE
Latin capital letter C with cedilla
Latin capital letter E with grave
Latin capital letter E with acute
Latin capital letter E with circumflex
Latin capital letter E with diaeresis
Latin capital letter I with grave
Latin capital letter I with acute
Latin capital letter I with circumflex
Latin capital letter I with diaeresis
Latin capital letter ETH
Latin capital letter N with tilde
Latin capital letter O with grave
Latin capital letter O with acute
Latin capital letter O with circumflex
Latin capital letter O with tilde
Latin capital letter O with diaeresis
Multiplication sign
Latin capital letter O with slash
Latin capital letter U with grave
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
332
333
334
335
336
337
340
341
342
343
344
345
346
347
350
351
352
353
354
355
356
357
360
361
362
363
364
365
366
367
370
371
372
373
374
375
376
377
DA
DB
DC
DD
DE
DF
E0
E1
E2
E3
E4
E5
E6
E7
E8
E9
EA
EB
EC
ED
EE
EF
F0
F1
F2
F3
F4
F5
F6
F7
F8
F9
FA
FB
FC
FD
FE
FF
11011010 Ú
11011011 Û
11011100 Ü
11011101 Ý
11011110 Þ
11011111 ß
11100000 à
11100001 á
11100010 â
11100011 ã
11100100 ä
11100101 å
11100110 æ
11100111 ç
11101000 è
11101001 é
11101010 ê
11101011 ë
11101100 ì
11101101 í
11101110 î
11101111 ï
11110000 ð
11110001 ñ
11110010 ò
11110011 ó
11110100 ô
11110101 õ
11110110 ö
11110111 ÷
11111000 ø
11111001 ù
11111010 ú
11111011 û
11111100 ü
11111101 ý
11111110 þ
11111111 ÿ
&#218;
&#219;
&#220;
&#221;
&#222;
&#223;
&#224;
&#225;
&#226;
&#227;
&#228;
&#229;
&#230;
&#231;
&#232;
&#233;
&#234;
&#235;
&#236;
&#237;
&#238;
&#239;
&#240;
&#241;
&#242;
&#243;
&#244;
&#245;
&#246;
&#247;
&#248;
&#249;
&#250;
&#251;
&#252;
&#253;
&#254;
&#255;
&Uacute;
&Ucirc;
&Uuml;
&Yacute;
&THORN;
&szlig;
&agrave;
&aacute;
&acirc;
&atilde;
&auml;
&aring;
&aelig;
&ccedil;
&egrave;
&eacute;
&ecirc;
&euml;
&igrave;
&iacute;
&icirc;
&iuml;
&eth;
&ntilde;
&ograve;
&oacute;
&ocirc;
&otilde;
&ouml;
&divide;
&oslash;
&ugrave;
&uacute;
&ucirc;
&uuml;
&yacute;
&thorn;
&yuml;
Se Also:
StringReplace StringFind MemoFind MemoReplace
If you need to find the value of any character you can use this website to get the value:
http://asciivalue.com/index.php
Latin capital letter U with acute
Latin capital letter U with circumflex
Latin capital letter U with diaeresis
Latin capital letter Y with acute
Latin capital letter THORN
Latin small letter sharp s - ess-zed
Latin small letter a with grave
Latin small letter a with acute
Latin small letter a with circumflex
Latin small letter a with tilde
Latin small letter a with diaeresis
Latin small letter a with ring above
Latin small letter ae
Latin small letter c with cedilla
Latin small letter e with grave
Latin small letter e with acute
Latin small letter e with circumflex
Latin small letter e with diaeresis
Latin small letter i with grave
Latin small letter i with acute
Latin small letter i with circumflex
Latin small letter i with diaeresis
Latin small letter eth
Latin small letter n with tilde
Latin small letter o with grave
Latin small letter o with acute
Latin small letter o with circumflex
Latin small letter o with tilde
Latin small letter o with diaeresis
Division sign
Latin small letter o with slash
Latin small letter u with grave
Latin small letter u with acute
Latin small letter u with circumflex
Latin small letter u with diaeresis
Latin small letter y with acute
Latin small letter thorn
Latin small letter y with diaeresis
Function::String
ConCat
Usage:
ConCat(Field1,Field2,....,FieldN) ConCat(texststring1,texststring2,....,texstringN)
Purpose:
The Concat function combines two or more separate text values into one. Concat performs the same function as Jointext, but is simpler to use.
Concat - short for concatenation - joins two or more strings together into a single string.
As with Jointext, leading spaces in strings are retained, but trailing spaces are truncated.
Return value:
Text String up to 255 characters long.
Content:
Concat
Type
Text Function
Purpose
The Concat function combines two or more separate text values into one. Concat performs the same function as Jointext, but is simpler to use. Concat - short for concatenation - joins two or
more strings together into a single string.
As with Jointext, leading spaces in strings are retained, but trailing spaces are truncated.
Syntax
Concat (textstring1, textstring2?.textstringn).
? where textstringn continues as many times as you require
Returns
A text value up to 255 characters in length.
Example
Concat("My ", "name", " is", " Dave".
? would produce the string "MyName is Dave"
Notice that "MyName" has no space, because the trailing space in "My " was truncated. Whereas the words "Name is" are correctly spaced, because the string " is" had a leading space.
The Jointext function is retained, and can still be used.
Examples:
Example 1
Concat("My ", "name", " is", " Dave")
Result: My name is Dave
Example 2
Concat("The time is: ",current time," and the Date is: ", current date)
Result: (Now!): The time is: 20:44:03 and the Date is: 10/12/2012
Se Also:
JoinText MemoCopy MemoMemoCopy
Function::Internal
ConsoleCopy
Usage:
ConsoleCopy(Text,Mode) ConsoleCopy("This is a test",4) ConsoleCopy(MessageField,4) retval := ConsoleCopy(MyMessage,4) (Reason we use 4 in all examples is that this
is append with CR before which is the most meaningful when you add a line to the console)
Purpose:
The console is basically screen print in DFD, and in version 1 it even looks like DOS ;-) The console will have many purposes.
1. You can use it as a DEBUG window and use ConsoleCopy() to put messages on the console during a procedure run instead of Window/Dialog messages.
2. You can use it as a report output the way you used to in DFD. You will have to build your own output, but that is what most of us did in DFD anyway (OUTPUT)
3. You can use it to generate a print or export. You can of course already do that via the new file functions, but this way you will be able to visualise it too. The nice thing with the
console is that it is unique for each application, but there is only one, so you can add stuff to it from anywhere in your application and when happy, you can simply save it to a
file with ConsoleWriteTofile() or print it to a Windows device (printer) with the same function.
Plenty of other uses too, this is just the start.
Return value:
Nothing
Content:
Examples:
Se Also:
ConsoleShow()
ConsoleWriteToFile()
MemoConsoleCopy()
Function::Memo
ConsoleMemoCopy
Usage:
ConsoleMemoCopy(Memo,Mode) ConsoleMemoCopy(MyMemo,4) ConsoleMemoCopy(MessageField,4) retval := ConsoleMemoCopy(MyMessage,4) (Reason we use 4 in all
examples is that this is append with CR before which is the most meaningful when you add a line to the cons
Purpose:
The console is basically screen print in DFD, and in version 1 it even looks like DOS ;-) The console will have many purposes.
1. You can use it as a DEBUG window and use ConsoleCopy() to put messages on the console during a procedure run instead of Window/Dialog messages.
2. You can use it as a report output the way you used to in DFD. You will have to build your own output, but that is what most of us did in DFD anyway (OUTPUT)
3. You can use it to generate a print or export. You can of course already do that via the new file functions, but this way you will be able to visualise it too. The nice thing with the
console is that it is unique for each application, but there is only one, so you can add stuff to it from anywhere in your application and when happy, you can simply save it to a
file with ConsoleWriteTofile() or print it to a Windows device (printer) with the same function.
Plenty of other uses too, this is just the start.
Return value:
Nothing
Content:
Examples:
Se Also:
ConsoleShow()
ConsoleWriteToFile()
ConsoleCopy()
MemoConsoleCopy()
Function::Internal
ConsoleShow
Usage:
ConsoleShow(Switch) ConsoleShow(0) - Hide Console Window ConsoleShow(1) - Show Console WIndow retval := ConsoleShow(MySwitch)
Purpose:
This function hide or show the console window. Console Window is initially hidden.
Return value:
Nothing
Content:
Examples:
Se Also:
ConsoleCopy()
MemoConsoleCopy()
ConsoleWriteToFile()
MemoMemoCopy()
MemoCopy()
WriteToFile()
MemoWriteToFile()
Function::Memo
ConsoleWriteToFile
Usage:
ConsoleWriteToFile(Filename,Mode) ConsoleWriteToFile(MyFilPath,1) ConsoleWriteToFile("mytextfile.txt",1) ConsoleWriteToFile("\\DATAEASE8\HP Color Laserjet 4700",1) -use Printer Share Name to send text directly to printer. retval := ConsoleWriteToFile("M
Purpose:
The console is basically screen print in DFD, and in version 1 it even looks like DOS ;-) The console will have many purposes.
1. You can use it as a DEBUG window and use ConsoleCopy() to put messages on the console during a procedure run instead of Window/Dialog messages.
2. You can use it as a report output the way you used to in DFD. You will have to build your own output, but that is what most of us did in DFD anyway (OUTPUT)
3. You can use it to generate a print or export. You can of course already do that via the new file functions, but this way you will be able to visualise it too. The nice thing with the
console is that it is unique for each application, but there is only one, so you can add stuff to it from anywhere in your application and when happy, you can simply save it to a
file with ConsoleWriteTofile() or print it to a Windows device (printer) with the same function.
Plenty of other uses too, this is just the start.
Return value:
Nothing
Content:
Examples:
Se Also:
ConsoleShow()
MemoConsoleCopy()
ConsoleCopy()
ConsoleMemoCopy()
Function::Action
CopyRecord
Usage:
CopyRecord () retval := CopyRecord () .
Purpose:
Copies selected record(s)
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
CopySelected
Usage:
CopySelected() retval := CopySelected() .
Purpose:
Copies selected data to clipboard
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
CopySpecial
Usage:
CopySpecial () retval := CopySpecial () .
Purpose:
Copy the selected record(s) data to the clipboard.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Mathematical
Cos (cosine)
Usage:
cos(numeric field) cos(numeric value) cos(90)
Purpose:
The cos function calculates the cosine of an angle expressed in radians. The value returned ranges between -1 and 1.
Return value:
Numerical value between -1 via 0 to +1
Content:
cos (cosine)
Type
Trigonometric Function
Purpose
The cos function calculates the cosine of an angle expressed in radians. The value returned ranges between -1 and 1.
Syntax
cos( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value or an expression.
Examples
cos( 3.1415928)
Returns: -1
cos( -22)
Returns: .9271838
Examples:
Examples 1
cos( 3.1415928)
Returns: -1
Examples 2
cos( -22)
Returns: .9271838
Se Also:
CosH (Hyperbolic cosine) Sin Tan (tangent)
Function::Mathematical
CosH (Hyperbolic cosine)
Usage:
cosh(numeric field) cosh(numeric value) cosh(90) cosh(myvalue+yourvalue*theirvalue)
Purpose:
The cosh function calculates the hyperbolic cosine of an angle expressed in radians.
Return value:
Numeric value
Content:
cosh (hyperbolic cosine)
Type
Trigonometric Function
Purpose
The coshfunctioncalculates the hyperbolic cosine of an angle expressed in radians.
Syntax
cosh(NUMERIC VALUE)
Usage
The numericvaluein a Trigonometricfunctioncan be aconstantvalue(as shown below), avariable, a fieldvalueor an expression.
Returns
A numericvalue.
Examples
cosh(2.34)
Returns:5.23878166
cosh(-5.4)
Returns:110.70547
Examples:
Examples 1
cosh(2.34)
Returns:5.23878166
Examples 2
cosh(-5.4)
Returns:110.7054
Se Also:
Cos (Cosine) Sin Tan (tangent)
Function::Internal
Count Of
Usage:
count of RELATIONSHIP count of TABLENAME Syntax: count of TABLENAME|RELATIONSHIP [ named "UNIQUE RELATIONSHIP NAME" ] [ with {selection criteria} ]
Purpose:
The count of operator counts how many records in a related table match the specified selection criteria. The result can appear as a list item in the detail area of a report or as a
statistic in the summary area at the end of a report.
There's an important difference between the conditional statistical operator count and the relational statistical operator count of. count finds the number of records that satisfy a
specified condition among the records being processed. count of calculates the number of matching records related to the records being processed by the script.
Return value:
Numeric Value The number of records that fit the relational restriction.
Content:
count of
Type
Relational Statistical Operator
Purpose
The count of operator counts how many records in a related table match the specified selection criteria. The result can appear as a list item in the detail area of a report or as a statistic in the
summary area at the end of a report.
There's an important difference between the conditional statistical operator count and the relational statistical operator count of. count finds the number of records that satisfy a specified
condition among the records being processed. count of calculates the number of matching records related to the records being processed by the script.
Syntax
count of TABLENAME|RELATIONSHIP
[named "UNIQUE RELATIONSHIP NAME" ]
[with ( selection criteria) ] ;|.
Example
for MEMBERS with STATE = "CA" ;
list records
LASTNAME in order ;
TOTAL DUE ;
TOTAL DUE > 100 : item count ;
count of RESERVATIONS with ( TOTAL DUE > 1500) .
end
This script tells DataEase: (1) Process all the MEMBERS records of members living in California, (2) list the LAST NAME and TOTAL DUE field from each MEMBERS record, (3) for each member,
display a YES or NO answer indicating if the member's TOTAL DUE is greater than \$100, (4) count the total number of members whose TOTAL DUE is greater than \$100 and display this total as a
statistic at the end of the report output (this is generated by the count operator), and (5) count the number of related RESERVATIONS records that have a TOTAL DUE greater than \$1500, and
display this number as a list item for each member (this is generated by the count of operator).
Examples:
Example 1
In a field derivation.Simplest type. We have two tables. ThisTable and MyCustomers. We have no relationships defined.
count of MyCustomers
This will return the number i have.
Example 2
We have two tables.CustomerType and MyCustomers. We have a relationship between them that connect CustomerType and MyCustomers on customer type.There is no
Unique Alternative Name for the Relationship. I have 300 records in MyCustomer and 45 of type Good Credit.
My active record in CustomerType is the Good Credit record.
count of MyCustomers
This will return the number 45 as I am now using the relationship instead of the table.
count of MyCustomers named "AllRecords"
Example 3
count of MyCustomers named "NewRel" with RegistrationDate=current date
This will return the number of customers registered today.
Example 4
for MEMBERS with STATE = "CA" ;
list records
LASTNAME in order ;
TOTAL DUE ;
TOTAL DUE > 100 : item count ;
count of RESERVATIONS with ( TOTAL DUE > 1500) .
end
This script tells DataEase: (1) Process all the MEMBERS records of members living in California, (2) list the LAST NAME and TOTAL DUE field from each MEMBERS record, (3)
for each member, display a YES or NO answer indicating if the member's TOTAL DUE is greater than \$100, (4) count the total number of members whose TOTAL DUE is
greater than \$100 and display this total as a statistic at the end of the report output (this is generated by the count operator), and (5) count the number of related
RESERVATIONS records that have a TOTAL DUE greater than \$1500, and display this number as a list item for each member (this is generated by the count of operator).
Se Also:
Sum Of Highest Of Lowest Of Mean Of
Function::Internal
CreateTable
Usage:
CreateTable("NewTablename","Keyword","TemplateTable") CreateTable("NewTable130215","Copy","MyCustomers") CreateTable("MyTable","Delete")
retval:=CreateTable("ATable","Copy","Customers") .
Purpose:
To create a table during runtime that can be used for storing history, data-manipulation and eventually direct user interaction.
In version 1 this function will only be usable from ExecDQL as all other Documents/procedure can only access pre-defined tables.
Return value:
Result:text
Content:
Examples:
Se Also:
Function::Internal
Current
Usage:
CURRENT DATE|CURRENT EXTENDED DATE|CURRENT TIME|CURRENT PAGE NUMBER|CURRENT USER LEVEL|CURRENT COMPUTERNAME|CURRENT STATUS
Purpose:
current date
current extended date
current time
The date recorded by the system clock (a date value). The year part is a two digit number.
The date recorded by the system clock (a date value). The year part is a four digit number.
The time recorded by the system dock (a time value).
current page number
In DataEase, this command is replaced by the Page Number applicationvariable. current page number is included only to maintain
compatibility with applications created in character-based versions of DataEase. See DG 6 for information on creating application
variables.
current Item number
current user name
The number of the current record. Records are automatically counted as they are processed by the procedure (a numeric value).
The name used to sign onto the application (a text value).
current user level
The current user's security level (a numeric value from 1 to 7).
current computername
The name of the workstation running the procedure when using DataEase in a multi-user environment (a text value set by the DENAME
environmentvariable).
current status
The value of the processing action selected following the DQL input usingcommand or the status of the last DQL command that
modifies data. By testing the current status variable, you can control subsequent processing following an input using command or
check for errors following a DQL command that modifies data. See the input using command for an example of current status used with
the input using command.
Syntax:
CURRENT Parameter(s)
Return value:
Correct Type for Function. Current User Name will return Text String. Current Date will return Time Value and Current Date will return Date value etc. When current status is
used with the input using command, it returns a numeric value from 1 to 4 depen
Content:
current
Type
Variable component
Purpose
The current keyword lets you access any of the eleven system defined variables summarized below and on the following page.
Variables Used with the current Keyword
current date
The date recorded by the system clock (a date value). The year part is a two digit
number.
Current extended date
The date recorded by the system clock (a date value). The year part is a four digit
number.
current time
The time recorded by the system dock (a time value).
current page number
In DataEase, this command is replaced by the Page Number applicationvariable.
current page number is included only to maintain compatibility with applications
created in character-based versions of DataEase. See DG 6 for information on
creating application variables.
current Item number
The number of the current record. Records are automatically counted as they are
processed by the procedure (a numeric value).
current user name
The name used to sign onto the application (a text value).
current user level
The current user's security level (a numeric value from 1 to 7).
current computername
The name of the workstation running the procedure when using DataEase in a multiuser environment (a text value set by the DENAME environmentvariable).
current status
The value of the processing action selected following the DQL input usingcommand or
the status of the last DQL command that modifies data. By testing the current
status variable, you can control subsequent processing following an input
using command or check for errors following a DQL command that modifies data. See
the input using command for an example of current status used with the input
using command.
The following variables are used only in applications that access data on an SQL database:
current SQLCODE
The SQL Error Code number generated by the server when an error occurs during
the processing of an SQL statement (e.g., CREATE, INSERT, UPDATE, or DELETE).
current SQLCODE is set to zero if the last SQL statement is processed without error.
Server-specific error codes are explained in your database engine documentation.
See the commit andexec SQL commands for examples.
current SQLCOUNT
The number of rows processed by the procedure. See the exec SQLcommand for an
example.
current SQLMSGTXT
The SQL Message Text generated by the server, in addition to any errors and
warnings (a server can return a current SQLCODE value of zero and still generate
SQL Message Text). DataEase displays the first 50 characters of the message.
Server-specific messages are explained in your database engine documentation. See
the exec SQL command for an example.
Note: See input using for examples demonstrating the use of the current status variable. See commit for examples that use current SQLCODE and current SQLCOUNT. See exec SQL for
examples using current SQLCODE, current SQLCOUNT, and current SQLMSGTXT.
When current status is used with the input using command, it returns a numeric value from 1 to 4 depending on which menu selection (or icon) the user chooses after entering data.
When current status is used with an enter a record, modify records, delete records, or commit command, it returns 0 (zero) if the command is processed successfully and -1 (negative 1) if the
command fails.
Syntax
current variable name
Example
list records
current date ;
current user name .
for MEMBERS with TOTAL DUE > 175 ;
list records
LAST NAME in order ;
TOTAL DUE ;
current item number end
This script tells DataEase: (1) Select the MEMBERS records that have a TOTAL DUE value greater than \$175, (2) list the LAST NAME and TOTAL DUE values and current item number (record
number) from each record that is processed, and (3) list the current date (today's date) and the current user name (the name of the user who generated the report).
The output from this script might looks as follows:
Report generated by: George McGrath Date: 01/20/99
Item #
Last Name
Total Due
1
2
3
4
Perrault
Christino
Stafford
Strachan
215.00
280.00
185.00
205.00
Examples:
Example 1
Using current username to display a welcome message in a virtual field. The current user is Andy MacGrath
concat("Welcome to our application ", current username, " ;-)")
Result: Welcome to our application Andy MacGrath ;-)
Example 2
Using current user level to show or hide the secret field Customer Comments.
Result: This will hide the field if the current user level is lower then High and show it if it is High.
Example 3
list records
current date ;
current user name .
for MEMBERS with TOTAL DUE > 175 ;
list records
LAST NAME in order ;
TOTAL DUE ;
current item number end
This script tells DataEase: (1) Select the MEMBERS records that have a TOTAL DUE value greater than \$175, (2) list the LAST NAME and TOTAL DUE values and current item
number (record number) from each record that is processed, and (3) list the current date (today's date) and the current user name (the name of the user who generated the
report).
The output from this script might looks as follows:
Report generated by: George McGrath Date: 01/20/99
Item #
Last Name
Total Due
1
Perrault
215.00
2
Christino
280.00
3
Stafford
185.00
4
Strachan
205.00
Se Also:
GetCurrent
Function::Action
CutSelected
Usage:
CutSelected() retval := CutSelected() .
Purpose:
Deletes selected data from current form and copies to clipboard
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
DataExport
Usage:
DataExport ("Export.dbe") . retval := DataExport ("") . DataExport("") . DataExport(Concat(GetCurrent("AppPath","\Exports\",myexportdef,".dbe"))
Purpose:
Runs a Export.dbe or display Export Dialogue
DataExport() exploit the current multiview (columns, filters etc) and can be used anywhere there is created a multiview.
You can use it to export from a Form, A report or a DQL as long as you fire it with a .dbe after the multiview is created.
A .dbe can be "cross used" as it will only be limited by the selected column names, so a DBE created in one place can be used in a completely different place as long as the
column names are the same.
This is a workaround to export from a DQL document or a report where it can be difficult to create the DBE as this can be created in the Table definition form.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
DataImport
Usage:
DataImport ("Import.dbi") . retval := DataImport ("") . DataImport("") . DataImport(Concat(GetCurrent("AppPath","\imports\",myimpordef,".dbi"))
Purpose:
Runs an import (.DBI) or displays the import dialog if no DBI is specified.
DataImport is not related to the current document and a full specification need to be included. It is not limited by the current multiview. You can import anything into any table
from anywhere in the application.
This is the direct opposite from DataExport() which use the current Multiview to limit and control the export.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
DataImport
Usage:
DataImport ("Import.dbi") . retval := DataImport ("") . DataImport("") . DataImport(Concat(GetCurrent("AppPath","\imports\",myimpordef,".dbi"))
Purpose:
Runs an import (.DBI) or displays the import dialog if no DBI is specified
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::DateTime
Date
Usage:
date(06,28,12) date(MONTH,DAY,YEAR) date(MM,DD,YY) date(MyMonthField,MyDayField,MyYearField)
Purpose:
The date function constructs a DataEase date value from three separate numeric values. You can use constants, fields, functions or derivations to deduct the values.
If any input value is invalid (e.g., month > 12 or day > 31), DataEase calculates a future date, for example, 6,45,95 becomes 07/15/95
Decimal values are automatically truncated.
Return value:
A datevalue in the Short Date format specified in the Windows Control Panel. For example, if you specify the United Kingdom default date format in Control Panel, the date
value is returned in the order DD/MM/YY.
Content:
Home>DQL Guide>DQL Lexicon> date
date
Type
Date Function
Purpose
The datefunctionconstructs a datevaluefrom three separate numericvalues.
Syntax
date(MONTH, DAY, YEAR)
?where;
MONTHis the number of the month (1-12),
DAYis the day of month (1-31), and
YEARis the last two digits of year, or the full four digit year, depending on the type of date field.
Returns
A datevaluein the Short Date format specified in theWindows Control Panel. For example, if you specify the United States default date format in Control Panel, the datevalueis
returned in the order MM/DD/YY.
Usage
If any inputvalueis invalid (e.g., month > 12 or day > 31), DataEase calculates a future date, for example, 6,45,95 becomes 07/15/95
Decimalvaluesare automatically truncated.
Example 1
date(7,1,99)
Returns:07/01/99
Example 2
FIRSTDAY:=date(month(TODAY), 1, year(TODAY));
LASTDAY:=date((month(TODAY)+1), 1, year(TODAY))-1.
This portion of ascriptuses avariablenamed TODAY (which holds the current date) and two other datefunctions, month and year, to find the first and last days of the current
month.
The result, if the current date is July 4th, 1995, is: FIRSTDAY = 07/01/2001 LASTDAY = 07/31/01 This routine is accurate for any date.
Note: If your system is configured for an international date format other than United States, the datevaluemay be returned in the order DD/MM/YY or YY/MM/DD. See your
Microsoft Windows documentation to find the date format that corresponds to yourWindows Control Panelcountry setting.
Regardless of how your system is configured, the three numericalvaluesthisfunctionrequires are always input in the order MONTH, DAY, YEAR.
Examples:
Example 1
date(7,1,99)
Returns:07/01/99
Example 2
FIRSTDAY:=date(month(TODAY), 1, year(TODAY));
LASTDAY:=date((month(TODAY)+1), 1, year(TODAY))-1.
This portion of ascriptuses avariablenamed TODAY (which holds the current date) and two other datefunctions, month and year, to find the first and last days of the current
month.
The result, if the current date is July 4th, 1995, is: FIRSTDAY = 07/01/2001 LASTDAY = 07/31/01 This routine is accurate for any date.
Note: If your system is configured for an international date format other than United States, the date value may be returned in the order DD/MM/YY or YY/MM/DD. See your
Microsoft Windows documentation to find the date format that corresponds to your Windows Control Panel country setting.
Regardless of how your system is configured, the three numerical values this function requires are always input in the order MONTH, DAY, YEAR.
Se Also:
Day Month Year
Function::Internal
DatePicker
Usage:
DatePicker() SetValue("MyDateField",DatePicker() datefield := DatePicker().
Purpose:
To allow the user to choose a date from a calendar instead of having to key it in.
Return value:
Selected date.
Content:
We are currently on the final stretch of DataEase 8 new functionality. One function that a lot of you have been wanting is a date picker.
In a moment of weakness almost a year ago, I put it on a list of thing we would do if we ever got the time, which normally would
mean...Never...;-)
As I have had to eat a lot of humble pie over the last 12 months, I decided that we should ease up on the arrogance and listen to
the public.
And that is why we can now reveal that the DatePicker() is a confirmed function for the DataEase 8 runners up.
For every one that want this function we have 5 traditionalist that don't want it, so we will not interfere with the standard date field it is rather efficient to just punch in a date, instead we will add it as a rather stupid function.
date DatePicker(Date)
DatePicker()
You can of course input any date you want, and the month for that date will show up.
Nifty!
Examples:
Se Also:
Function::DateTime
Day
Usage:
Day(DATE VALUE) Day(Current Date) Day(28/01/12) Day(MyDateField)
Purpose:
The day function extracts the day of the month (1-31) from a date value.
The date format selected in Windows Control Panel changes the date sequence but does not affect which value is returned by a Date function.
Return value:
An integer value between 1 and 31
Content:
day
Type
Date Function
Purpose
The day function extracts the day of the month (1-31) from a date value.
Syntax
day( DATE VALUE)
Returns
An integer value between 1 and 31
The date format selected in Windows Control Panel changes the date sequence but does not affect which value is returned by a Date function.
Examples
day(12/31/01)
Returns:31 (United States format)
day(31/12/01)
Returns:31 (Australian, English Canadian, South American, most European formats)
day(01/12/31)
Returns:31 (Austrian, French Canadian, Taiwanese, South Korean, some European formats)
Examples:
Examples
day(12/31/01)
Returns:31 (United States format)
day(31/12/01)
Returns:31 (Australian, English Canadian, South American, most European formats)
day(01/12/31)
Returns:31 (Austrian, French Canadian, Taiwanese, South Korean, some European formats)
Se Also:
Month Year Date WeekDay YearDay
Function::Action
DesignerView
Usage:
DesignerView() retval := DesignerView() .
Purpose:
Switch current document to Designer view. This will only work in Development version of DataEase. If this function is applied in a runtime environment it will return a error
message.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
DocumentClose
Usage:
DocumentClose() retval:=DocumentClose()
Purpose:
Closes the current document.
Return value:
Status: integer
Content:
Examples:
Examples 1: Save record and close.
RecordSave()+DocumentClose() -- this might cause GPF because the form close before it is saved (big form) so alternative is to include a wait.
RecordSave()+wait(0.1)+DocumentClose()
Se Also:
Function::Internal
DocumentCloseName
Usage:
DocumentCloseName(DocumentName) DocumentCloseName("Full Windows Document Name i.e. Caption" DocumentCloseName("Customers")
DocumentClsoeName("Customers via Orderform") DocumentCloseName("DESIGN FORM : Customers") retval := DocumentCloseName(data-entry fie
Purpose:
To close a document by "remote". Many times when you have open a form for information or run a report/procedure with output, you want that document to be closed. If focus
has been returned to another document this is not always straight forward so we have added DocumentCloseName() so you can close a document from anywhere in an app.
If the document in name is already closed or does not exist no action will be taken, and no error message returned.
Return value:
String, nothing!
Content:
Examples:
Se Also:
DocumentClose()
DocumentOpen()
Function::Action
DocumentDelete
Usage:
DocumentDelete("") retval := DocumentDelete("") . DocumentDelete("NamedDocument") .
Purpose:
Delete a document in the application. If no document is specified it will open the Delete a Document dialogue.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
DocumentOpen
Usage:
Purpose:
If DocName is not empty the specified document will be opened. If DocName is empty then a dialog will display with all documents.
DFW Action(s): Document Open -- Enter: Document Name
Return value:
Status : integer
Content:
Examples:
Se Also:
Function::Internal
DoesObjectExist
Usage:
DoesObjectExist("ObjectName") DoesObjectExist("CustomerName") if (DoesObjectExist("MyObjectName")>0,"Yes","No") NumberOfObjects :=
DoesObjectExist("ObjectName") . DoesObjectExist(concat("MyObject#",GetCurrent("RowNumber"))
Purpose:
To check if an object is available in the current form or to find the number of objects with the same name.
When you use a subform or a multi-record form the object names are cloned so if you have 40 rows in a subform you will have 40 object clones with the same name. If you
want to manipulate or populate them all you need to loop through them, so it will be useful to know how many clones of the object there is.
Another use is to check if a specific clone exist for instance nr. 13. DoesObjectExist("CustomerName#13").
Return value:
The nuumber of object with this name in the current document. 0 is none, 1,2,3 etc.
Content:
Examples:
Se Also:
Function::Internal
ExecDQL
Usage:
ExecDQL("DQL Script","Data-Entry Field1","Data-Entry Field2","Data-Entry Field3","Data-Entry Field3","Export File") ExecDQL("delete records in MyTable.") ExecDQL("for My
Table with MyField=Data-Entry Field1 ; modify records My Field2=data-entry field2 .",
Purpose:
To run a DQL script as a function from anywhere.
DQL is the most useful part of a DE application but it has had its limitations because it has been part of the DQL document (report). With ExecDQL we have liberated it, and
you can now call a DQL from anywhere at anytime. It follow normal DQL syntax rules and it will generate an variable length export file if you include a file name as the last
parameter (parameter 6).
Because it is a function you have to reference the Data-entry fields (transfered as parameter 2-5) with fixed names i.e Field1, Field2, Field3 and Field4. Other than that it is
The ExecDQL has the GUI context of the document from where it is called, so you can read and manipulate the document from the DQL. This means that ExecDQL is not only
a Data manipulating procedure it can also be a GUI manipulating procedure.
If you need more input variables than 4 you can simply pick them out of the Form you are calling the ExecDQL from with GetValue()
To make ExecDQL and other parts of DE8 more effective we have also introduced ESCAPE values in DE8 Strings.
Early in 8.0 we introduced CHR() to make it easier (possible) to use reserved letters in DE derivations and DQL etc. However it is a little awkward when you have to use
ConCat() to joint things together for instance in a ExecDQL etc.
Ex.
ExecDQL(concat("message ", chr(34), "Hello world!",chr(34)," window.","","","","","")
So now you can simply do this with the escape charcter for ".
Ex.
ExecDQL("Message /'Hello World!/' window .")
The observant reader also see that we don't add all the "" at the end of the function. This is news in 8.2 too. We have introduced variable number of parameters to make the
functions more user friendly.
Up to now you had to be exact with your parameters and that could be a chore when the only thing you wanted was to execute a small line of commands with no export, and no
input.
You will still have to follow the numbers so if you want to include an export file for ExecDQL you will need to include 4 empty "" as parameters before the export file name, but if
you only need two data-entry parameters you can now simply add the two and skip the 3 last parameters.
Return value:
Nothing
Content:
Examples:
Se Also:
CHR()
GetValue()
MemoExecDQL()
LabelExecDQL()
TextExecDQL()
StringEscape()
Function::Action
ExitDataEase
Usage:
ExitDataEase () retval := ExitDataEase() . ExitDataEase("Silent") -- will close without asking for confirmation.
Purpose:
Closes DataEase completely.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Mathematical
Exp
Usage:
exp(NUMERIC VALUE) exp(MyNumberField) exp(32)
Purpose:
The exp function calculates the exponential value of a numeric value.
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Return value:
A numeric value equal to ex where e = 2.71828183
Content:
exp
Type
Scientific Function
Purpose
The exp function calculates the exponential value of a numeric value.
Syntax
exp( NUMERIC VALUE)
Returns
A numeric value equal to ex where e = 2.71828183
Usage
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
exp(2)
Returns:7.3890561
exp(-3)
Returns:.0497871
Examples:
Examples
exp(2)
Returns:7.3890561
exp(-3)
Returns:.0497871
Se Also:
Log Log10 Std.Dev. (standard deviation)
Function::Action
FieldClear
Usage:
FieldClear () retval := FieldClear () .
Purpose:
Clears current field
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::File
FileExecDQL
Usage:
FileExecDQL("DQL TExT FILE","Data-Entry Field1","Data-Entry Field2","Data-Entry Field3","Data-Entry Field3","Export File") FileExecDQL("C:\myDQLs\deleteall.dql")
Purpose:
To run a DQL script stored in a file as a function from anywhere.
DQL is the most useful part of a DE application but it has had its limitations because it has been part of the DQL document (report). With ExecDQL we have liberated it, and
you can now call a DQL from anywhere at anytime. It follow normal DQL syntax rules and it will generate an variable length export file if you include a file name as the last
parameter (parameter 6).
Because it is a function you have to reference the Data-entry fields (transfered as parameter 2-5) with fixed names i.e Field1, Field2, Field3 and Field4. Other than that it is
The ExecDQL has the GUI context of the document from where it is called, so you can read and manipulate the document from the DQL. This means that ExecDQL is not only
a Data manipulating procedure it can also be a GUI manipulating procedure.
If you need more input variables than 4 you can simply pick them out of the Form you are calling the ExecDQL from with GetValue()
Return value:
Nothing
Content:
Examples:
Se Also:
GetValue()
MemoExecDQL()
LabelExecDQL()
ExecDQL()
StringEscape()
GetCurrent()
Function::Action
FilterClear
Usage:
FilterClear() retval := FilterClear().
Purpose:
Display all records regardless of selection filter/sort order.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
FilterSet
Usage:
FilterSet() retval := FilterSet().
Purpose:
Display records according to the specified selection filter/sort order.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::String
FirstC
Usage:
FirstC(TEXT VALUE,n) FirstC("Your name",4) FirstC(MyField,MyStringLength) FirstC(Lookup MyCustomer CustomerName,TitleLength)
Purpose:
The firstc function extracts a specified number of characters (n) from the beginning (left) of a text value.
Leading blanks are included in the count of characters (n).
Return value:
A text string n characters in length from the beginning of the string inputted.
Content:
firstc
Type
Text Function
Purpose
The firstc function extracts a specified number of characters (n) from the beginning (left) of a text value.
Syntax
firstc( TEXT VALUE, n)
Returns
A text string n characters in length.
Usage
Leading blanks are included in the count of characters (n).
Examples
firstc ( "Sapphire International Ltd." , 8)
Returns: Sapphire
firstc ( "Club ParaDEASE" , 6)
Returns: Club P
firstc ( LAST NAME, 4)
Returns: The first four characters
Examples:
Examples
firstc ( "Sapphire International Ltd." , 8)
Returns: Sapphire
firstc ( "Club ParaDEASE" , 6)
Returns: Club P
firstc ( LAST NAME, 4)
Returns: The first four characters
Se Also:
FirstW LastC LastW MidC MidW TextPos
Function::String
FirstLast
Usage:
FirstLast(TEXT VALUE) FirstLast("Hilbert Hockenheim") FirstLast(MyTextField) FirstLast(Lookup Customer Customername)
Purpose:
The firstlast function converts a text value from the format: LastName, FirstName [M.] to the format: FirstName[M.]LastName. The [M.] is an optional middle initial (or name).
This function is used when names are stored in a single field. The contents of the field are rearranged so the first word (i.e., the last name) becomes the last word in the
returned string. If the name is followed by a comma, the comma is deleted.
If there is only one Word the function will do nothing.
Return value:
Thisfunctionis used when names are stored in a single field. The contents of the field are rearranged so the first word (i.e., the last name) becomes the last word in the
returned string. If the name is followed by a comma, the comma is deleted.
Content:
firstlast
Type
Text Function
Purpose
The firstlastfunctionconverts a textvaluefrom the format: LastName, FirstName[M.] to the format: FirstName[M.]LastName. The [M.] is an optional middle initial (or name).
Syntax
firstlast(TEXT VALUE)
Returns
A textvalue.
Usage
Thisfunctionis used when names are stored in a single field. The contents of the field are rearranged so the first word (i.e., the last name) becomes the last word in the
returned string. If the name is followed by a comma, the comma is deleted.
Examples
firstlast("Anthony, Susan B.")
Returns: Susan B. Anthony
firstlast("Eliot, T.S.")
Returns: T.S. Eliot
firstlast(FULL NAME)
Returns: Thevaluein the FULL NAME field in the format shown above for every record that is processed. If a record contains thevalueHolmes, Sherlock in the LAST NAME field,
thefunctionreturns Sherlock Holmes.
Examples:
Examples
firstlast("Anthony, Susan B.")
Returns: Susan B. Anthony
firstlast("Eliot, T.S.")
Returns: T.S. Eliot
firstlast(FULL NAME)
Returns: Thevaluein the FULL NAME field in the format shown above for every record that is processed. If a record contains thevalueHolmes, Sherlock in the LAST NAME field,
thefunctionreturns Sherlock Holmes.
Se Also:
LastFirst FirstW LastW MidW StringFind StringReplace
Function::String
FirstW
Usage:
FirstW(TEXT VALUE,n) FirstW("My Text String. My Second Text String.",3) FirstW(MyTextField,MyWordCount) FirstW(Concat(Firstname,Lastname),2)
Purpose:
The firstw function extracts a specified number of words from the beginning (left) of a text value.
firstw(FIELDNAME, n) returns the first n words in the field, including intervening punctuation symbols. Leading spaces are treated as delimiters. Trailing spaces are ignored. If
there are n or fewer words in the field, firstw returns the original text value.
Return value:
A text value n words in length.
Content:
firstw
Type
Text Function
Purpose
The firstw function extracts a specified number of words from the beginning (left) of a text value.
Syntax
firstw( TEXT VALUE, n)
Returns
A text value n words in length.
Usage
firstw(FIELDNAME, n) returns the first n words in the field, including intervening punctuation symbols. Leading spaces are treated as delimiters. Trailing spaces are ignored. If there are n or
fewer words in the field, firstw returns the original text value.
Examples
firstw( "Sapphire International Ltd." , 2)
Returns: Sapphire International,
Returns: Club
Returns:The first two words in the ADDRESS field for every record that is processed. If a record contains the value 540 Avenida de los Delfines in the ADDRESS field, the function returns 540
Avenida.
Examples:
Examples
firstw( "4 The People Limited." , 2)
Returns: 4 The,
Returns: Club
Returns:The first two words in the ADDRESS field for every record that is processed. If a record contains the value 540 Avenida de los Delfines in the ADDRESS field, the
function returns 540 Avenida.
Se Also:
FirstLast LastFirst MidW LastW
Function::String
FixedWidth
Usage:
FixedWidth(Value,Position,Length) FixedWidth("My Heading",1,40) -- return string where My Heading is centered in a 40 character long space padded string.
FixedWidth(MyValue,MyPosition,MyLength)
Purpose:
FixedWidth return a space (blank) padded string "Length" long where Value is positioned according to the position switch.
The purpose of the function is to make it easier to build columns in a text file/export/console output.
The function is created to make DFW more compatible with DFD style thinking and output.
Especially useful in combination with WriteToFile(), ConsoleCopy() etc.
Return value:
String (up to 255) padded with blank to lenght.
Content:
Examples:
Example 1:
define temp "retval" text .
define temp "spacer" text 255 .
define temp "line" text 69 .
define temp "looper" number .
looper := 0 .
spacer :=" " .
line := "-------------------------------------------------------------------------------------------------------------------------" .
while looper <25 do
retval := ConsoleCopy(" ",5+0) .
looper := Looper +1 .
end
looper := 0 .
retval := ConsoleCopy(" ",5+0) .
for WriteToFile with OrderNr = Data-entry Field1 ;
looper :=looper + 1 .
end
retval := ConsoleCopy(" ",4+0) .
retval := ConsoleCopy(Subject,4+0) .
retval := ConsoleCopy(" ",4+0) .
retval :=ConsoleCopy(concat(FixedWidth("Productnr", 0 , 15),fixedWidth("Product Description", 0 , 29),FixedWidth("Price", 1+1 , 10),FixedWidth("#", 1+0 ,
5),FixedWidth("Total",2+0,10)) , 4+0) .
retval := ConsoleCopy(line, 4+0) .
for Orderlines with Ordernr = WriteToFile Ordernr ;
retval := ConsoleCopy(concat(FixedWidth(productNr,0,15) ,FixedWidth(Description,0,29),FixedWidth(Prices,2,10),FixedWidth(Count ,2,5),FixedWidth(Total,2,10)), 4+0) .
end
retval := ConsoleCopy(" ",5+0) .
retval := ConsoleCopy(FixedWidth(concat("Total Order: ", Total Order),2,69),4+0) .
retval := ConsoleCopy(line, 4+0) .
retval := ConsoleCopy(" ",5+0) .
retval := ConsoleCopy(" ",5+0) .
Looper := 0 .
while MemoChunk(Footer,Looper) not=blank do
retval := ConsoleCopy(MemoChunk(Footer,Looper),0) .
looper :=looper + 1 .
end
retval := ConsoleShow(1) .
Se Also:
Function::Mathematical
Floor
Usage:
Floor(NUMERIC VALUE) Floor(123.45) Floor(MyNumericalField) Floor(MyField1*VAT+TravelExpenses)
Purpose:
The floor function rounds down a numeric value to the next lowest integer.
Basically it strips off the decimals and leave an integer.
The numeric value in a Math function can be a constant value, a variable, a field value, or an expression
Return value:
Intger value.
Content:
floor
Type
Math Function
Purpose
The floor function rounds down a numeric value to the next lowest integer.
Syntax
floor( NUMERIC VALUE)
Returns
An integer value.
Usage
The numeric value in a Math function can be a constant value, a variable, a field value, or an expression.
Examples
floor( 5.000)
Returns: 5
floor( 5.999)
Returns: 5
floor ( ( current date - BIRTHDATE) /365.25)
Returns: The result of the age calculation. The operation contained in the interior set of parentheses is performed first and returns an age value expressed in days. The exterior calculation
converts the age in days to years. If the current date is 05/30/2001 and the value in the BIRTHDATE field is 07/02/62, the function returns 38.
Examples:
Examples
floor( 5.000)
Returns: 5
floor( 5.999)
Returns: 5
Se Also:
Ceil Mod (modulus)
Function::Action
FormClear
Usage:
FormClear() retval := FormClear().
Purpose:
Clear the current form and leave the form as new.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
FormOpenRelated
Usage:
FormOpenRelated("MyRelationship") FormOpenRealted("MyRelationship,MyDocument") FormOpenRelated("MyRelationship,MyForm")
FormOpenRelated("MyRelationship,MyReport") FormOpenRelated("CustomerRel,CustomerForm")
Purpose:
To open a document filtered by the relational constraint.
This is one of the most useful features in DataEase, where you open an existing document based on the relational constraint set by a pre-defined relationship. You can open
any type of document bar a DQL/Procedure this way. It will allow you to open a Procedure too, but it will not force the constraint.
You can use this to filter the result of a report instead of using a Procedure and data-entry. See Examples.
Return value:
Nothing.
Content:
Form Open Related
The Open Related Form icon opens a dialog box which shows all of the forms related to your current document. Highlight the form you want and click OK, and the related form
will be opened.
Form Open Related can be used to simply inspect data in a related form. It can also be used to select and return data, using the Return To icon.
Examples:
Se Also:
Function::Action
FormReorganize
Usage:
FormReorganize("TableName") retval := FormReorganize("TableName") . ForReorganize("*") -- reorganize all. FormReorganize("") -- Open Reorganize Dialogue
Purpose:
Reorganize means really to structure and update registers. There is two reasons why you want to reorganize a table or all tables.
1. You have a lot of deletions in your tables and you want to compact the tables to save space and increase efficiencies.
2 .DataEase report inconsistency in your data. Inconistency is really when the size of a .DBM (Data file) is not corresponding with the recorded size in RDRR (Registry).
Return value:
Status:int
Content:
Examples:
Se Also:
Function::Mathematical
FutureValue
Usage:
FutureValue(PRESENT VALUE,INSTALLMENT,RATE,PERIODS) FutureValue(NUMERICAL VALUE,NUMERICAL VALUE,NUMERICAL VALUE,NUMERICAL VALUE)
Purpose:
The futurevalue function calculates the final value of a financial transaction given the presentvalue, installment payment, interest rate, and number of payment periods.
If the installment payment increases the value of the investment (e.g., an annuity), the installment must be expressed as a positive amount. If the payment decreases the value
of the investment (e.g., loan amortization), the installment must be expressed as a negative amount.
The interest rate, installment payments, and time periods must be based on the same terms. For example, if payments are made monthly on a five-year loan, the number of
periods is (12*5) or 60. The interest rate must be expressed in the same terms (the monthly interest rate is the annual rate divided by 12). The interest rate must also be
expressed as a whole number (10% is 10, not 0.10).
Return value:
A numeric value (the final value after all payments are made).
Content:
futurevalue
Type
Financial Function
Purpose
The futurevalue function calculates the final value of a financial transaction given the presentvalue, installment payment, interest rate, and number of payment periods.
Syntax
futurevalue( presentvalue, installment, rate, periods)
Returns
A numeric value (the final value after all payments are made).
Usage
If the installment payment increases the value of the investment (e.g., an annuity), the installment must be expressed as a positive amount. If the payment decreases the value of the investment
(e.g., loan amortization), the installment must be expressed as a negative amount.
The interest rate, installment payments, and time periods must be based on the same terms. For example, if payments are made monthly on a five-year loan, the number of periods is (12*5) or 60.
The interest rate must be expressed in the same terms (the monthly interest rate is the annual rate divided by 12). The interest rate must also be expressed as a whole number (10% is 10, not
0.10).
Example 1
futurevalue( 10000, 100, 10 / 12, 120)
Returns: 47,554.91
This example calculates the futurevalue (accumulated balance) of a monthly savings plan, if you start with \$10,000 and add \$100 every month for 12 years at an annual interest rate of 10%.
Example 2
futurevalue( 10000, 1200, 10, 12)
Returns: 57,045.42
This example calculates the futurevalue (accumulated balance) of an annual savings plan, starting with \$10,000 and adding \$1200 each year for 12 years at an annual interest rate of 10%. Both
examples assume that installments are paid at the start of each period.
Note: When typing fractions like 10 / 12, DataEase requires that you type a space before and after the / division symbol.
DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ((1 + (rate/100)) ** periods) + (installment/(rate/100)) * (((1 + (rate/100)) ** periods) - 1)
Examples:
Example 1
futurevalue( 10000, 100, 10 / 12, 120)
Returns: 47,554.91
This example calculates the futurevalue (accumulated balance) of a monthly savings plan, if you start with \$10,000 and add \$100 every month for 12 years at an annual
interest rate of 10%.
Example 2
futurevalue( 10000, 1200, 10, 12)
Returns: 57,045.42
This example calculates the futurevalue (accumulated balance) of an annual savings plan, starting with \$10,000 and adding \$1200 each year for 12 years at an annual interest
rate of 10%. Both examples assume that installments are paid at the start of each period.
Note: When typing fractions like 10 / 12, DataEase requires that you type a space before and after the / division symbol.
DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ((1 + (rate/100)) ** periods) + (installment/(rate/100)) * (((1 + (rate/100)) ** periods) - 1)
Se Also:
Installment Presentvalue Percent Power Rate
Function::Internal
GetCurrent
Usage:
GetCurrent("AppPath") GetCurrent("ProgrPath") GetCurrent("MyDocuments") GetCurrent("RowNumber") GetCurrent("RecordNumber") GetCurrent("Width"
[,"ObjectName(Optional)"]) GetCurrent("Height"[,"ObjectName(Optional)"]) GetCurrent("WindowState")
Purpose:
The GetCurrent() functions is closely related to the old Current functionality in DataEase and is an addition to the existing Current values up to and including 7.2.
The New GetCurrent() function is a function to retrieve current information from DataEase. The first increment returned paths to different parts of the DE structure, then we
added features for navigating in the Form to help with setting and getting information on objects and now we are adding features to get information on the forms.
The new GetCurrent functions are all File paths and are included to make it easier to navigate from inside a DataEase App.
Everything from Images, to files, documents, exports etc. can be located in a dynamic structure and up to now it has been impossible to address them "relative" to the
Application, to the installed DataEase or to the users My Document structure.
The time when DataEase was installed on C:\DEASE and the app was in the program catalogue is long gone, and we now need to be able to navigate freely on different
installations.
Return value:
TEXT VALUE The full path to the designated parameter.
Content:
DataEae has been a little "wobbly" on referencing external stuff like Images etc.
There is an Imagepath in Application Preferences, but it has been rendered "defunct" so many times over the years, and nobody is really sure how it works anyway, so the only
safe bet has been to leave stuff directly in your App catalogue, or in the DataEase program catalogue itself.
For the messy people amongst us, this is OK, but even we get problems after a while when we can't find what we are looking for in an overgrown forest of .DBM .TDF .FRM
.TMP .PNG .BMP etc.
This problem might have been surmountable in older versions of DFW, where it was limited anyway what you could link into your DataEase forms. In DataEase 8 this problem
has become insurmountable, because you can now simply link in almost anything via our new WebField class etc.
Traditionally this was often solved by developers insisting that the App should be installed on C:\etc on the same path every time, but is this practical?
As a programmer I don't like leaving thing to chance or customers, I need to know that my app will work wherever it is put, so isn't it better to simply be able to deduct where you
are, and include this information in the paths?
We think so, so we have included a new function and called it GetCurrent in honour of the old and lovey current functionality in DataEase.
At the moment it returns only 3 values (but this will be extended as we progress and realise the need...)
GetCurrent("AppPath"), GetCurrent("ProgrPath") GetCurrent("MyDocuments")
The return value is string, and I guess the arguments is almost self explanatory, but for the slow amongst you:
1. AppPath = Your applicaiton path ex. C:\Users\Ulrik\Documents\My DataEase\7.3.Bug Apps\Andrey\UniqueID
2. ProgrPath = Where DataEase is installed ex. C:\Program Files (x86)\DataEase\DataEase 8.0\
3. MyDocuments - Where MS wants you to store your documents ex. C:\Users\Ulrik\Documents
All the above is genuine paths returned by GetCurrent just now for your enjoyment...
Examples:
Example 1
We have a picture archive where the images are stored in My Pictures under My Documents, and the images names are stored and organised in a DataEase application. The
Image name is stored in the field Image and we want to display a preview in an ImageField.
concat(GetCurrent("MyDocuments","/My Pictures/",Image)
As simple as that ;-)
Example 2
This is a slightly more advanced example that is taken from the Example - Send Advanced E-Mail in the Default Template in DataEase 8.
Her we have a button that open a file dialogue and point it on My Documents, when the user hit OK, the file name is appended with MemoCopy() to a Attachment field.
MemoCopy(Attachments,concat(GetFileName("","",GetCurrent("MyDocuments")),","),0)
Se Also:
Current MemoCopy WriteToFile
Function::Internal
GetlabelText
Usage:
GetLabelText("ObjectName") retval := GetLabelText("ObjectName") . SetLabelText("MyObject",GetLabelText("AnotherObject")
Purpose:
Labels, Buttons and Tabs (on tab control) have a string property which contain the text displayed on the item.
GetLabelText will query the object and return the text property stored in the object. Combined with SetLabelText() labels etc, can be used for storage of text between records etc.
Return value:
String that contain the text property of the object. If the object doesn't exist or has no text property it will return blank.
Content:
Examples:
Se Also:
Function::Internal
GetStyle
Usage:
GetStyle("ObjectName") retval := GetStyle("ObjectName") . SetStyle("MyObject",GetStyle("AnotherObject")
Purpose:
SetStyle() is maybe one of the most "revolutionary" new functions in DataEase 8.
We have already introduced new functions like SetColor(), SetLabelText(), SetState() etc. Using SetColor() to manipulate the look of an object can be cumbersome, so why not
use the much more powerful SetStyle()?
SetColor() can only change the color of Text, Fill and Border of objects, while SetStyle() can change all styleable properties on an object in one stroke. All color properties, font
type, size and style etc..
Since changing the style of an object will be "permanent" throughout as session it is important to be able to revert to the original style when you have finished with the
manipulation and this is where GetStyle() can help.
Simply Pick up the style and store it in a SetVar() before you start the manipulation, and then you can re-set it when you are finished.
Return value:
StyleName: Text
Content:
Examples:
Se Also:
SetStyle
Function::Internal
GetValue
Usage:
GetValue("ObjectName") retval := GetValue("ObjectName") . SetValue("MyObject",GetValue("AnotherObject") GetValue("MyObject#number")
Purpose:
To get the value of an object. This function is very useful in ExecDQL or to pick values out of non-referable fields like editable form virtual fields etc.
Remember that you can use this function to pick any field value but if you pick a Memo it will only return the first 255 characters.
This is a GUI function so it will return the value of the GUI object rather than the PRISM column that has populated it.
Return value:
String(255): The content of the object you queried.
Content:
Examples:
Se Also:
GetLabelText
GetStyle
SetVar
GetVar
Function::Internal
GetVar
Usage:
GetVar(TEXT VALUE) GetVar("My Variable") GetVar("CustomerName") GetVar("InvoiceTotal") GetVar("SystemDate")
Purpose:
Together with SetVarl() to allow users to transfer any number of values from any one part of the application to any other part of the application.
It will allow the user to name the variable and retrieve it by using the same name. GetVarl() and SetVarl() will automatically translate all DataEase Data types, so you can
transfer Text, Numbers, Numerical Strings, Choices, Dates, Time etc.
Return value:
Text Value that is converted to the field type of the field from which the function is called.
Content:
As part of the DataEase for Windows restoration project we have come to a big omission in DataEase - Global Variables or transfer of information between processes if you
like.
It amazes us how many wishes, needs and wants from almost every user, that has been blatantly ignored by "us". We have had no qualms in brushing off desperate user with
a CDF or a receipt long as your arm to "fix" a problem in our product.
In DataEase 8 we have deemed to remedy a lot of these omissions. It might be too late for a lot of users, but that excuse is getting to old too. When we took over development
we were told that yes LegEasy DOS is how it should have been done back in 1994 but alas, now it was too late.
Bull...it. We can't hide behind "too late". It is only too late if we think that DataEase will ever be used by people that have already used it, but our goal is to get it to be used by
people that have never used it too.
Just because there is some CDF's that can transfer a limited number of variables, and there is an SQL return code that one can use for the same, doesn't mean that the
problem is solved. Especially not when we are going to tell you all to not use DQL body for printing.
What? Not using DQL body for printing, not using DQL for printing? No! It doesn't work, and it never have. It is the achilles heel of DataEase for Windows and a couple of hours
working with it is enough to kill the spirit of the bravest.
DQL without Printing is both effective and amazing, but the way the body has been implemented is just backwards.
I can guarantee you that nobody that make a living from using DataEase use the DQL body for anything. So if you are a new user, don't even try.
The fact that the Data-Entry form is as limited doesn't make the situation any better.
Use DQL for processing, and use Report for printing! End of story!
The only reason we use DQL for printing is that that is what we used to do in DFD, and the reason we used to do that in DFD is because we need to have a data-entry form.
In DataEase 8, we have introduced Virtual Editable Field so you can make a DataEntry form as a normal for with relationships etc. Then you use the new
SetVarl("Variablename",Value) to set the global variables either in a virtual field or directly on the button that Fire the Report. In the report you set the Filter and use
GetGloal("Variablename") and the job is done.
With Set/GetVarl() you can have as many global variables as you like and you can give them descriptive names.
You can of course use them for anything you like, the above is just an example.
Examples:
Example 1
We want to use a certain value a lot of places, for instance the customers discount but we can't be bothered to set up a relationship between all tables.
Somewhere we call the function:
SetVar("UserDiscount",DiscountField)
Everywhere else we can then call.
GetVar("UserDiscount")
It will then always return the values set for UserDiscount until the session is ended or a new value is set with SetGlobal()
Example 2
You can also create dynamic global variables by creating dynamic names.
Somewhere we call the function:
SetVar(concat(current user name,current date),DiscountField)
Everywhere else we can then call.
GetVar(concat(current user name,current date))
It will then always return the values set for UserDiscount until the session is ended or a new value is set with SetVar()
Example 3
One major usage for SetVarl() and GetVarl() is to improve filtering and Data-Entry for reporting etc.
It is no secret that DQL printing "stinks" and it is no better in 8. It will be better with DataEase 8 Reporter, but the way that "hard core" DataEase developers have gotten around
this is by using Reports instead of DQL for printing.
The way you will do that is simply to set the Data-Entry values as Global variables and then you use GetVar() directly in the selection filter.
The Filter variable you simply set on the action for the button that executes the rapport from you form.
DocumentOpen( "MyQuickReport")+SetVar("MyCustomerName",CustomerName)
This way you can Run Reports directly to print without having to deal with the awkward DQL printing.
Se Also:
SetVar
MemoSetGlobal
MemoGetGlobal
Function::Internal
Highest Of
Usage:
highest of RELATIONSHIP column highest of TABLENAME column Syntax: highest of TABLENAME|RELATIONSHIP [ named "UNIQUE RELATIONSHIP NAME" ] [ with {selection
criteria} ] FIELDNAME
Purpose:
The highest of operator find the highest value of FIELDNAME across all records in a related table match the specified selection criteria. The result can appear as a list item in
the detail area of a report or as a statistic in the summary area at the end of a report.
Return value:
Numeric Value The highest value of FIELDNAME that fit the relational restriction. If no Relational restriction the highest value of FIELDNAME in the entire table.
Content:
highest of
Type
Relational Statistical Operator
Purpose
The highest of operator finds the highest value in a specified field in all matching records in a related table. The result can appear as a list item in the detail area of a report or as a statistic in the
summary area at the end of each group or the end of the report.
Syntax
highest of TABLENAME|RELATIONSHIP [named "UNIQUE RELATIONSHIP NAME" ] [with ( selection criteria) ] FIELDNAME ;|.
Returns
A value of the same type as the specified field. If a Text field is specified, DataEase returns the highest ASCII value. If a Choice field is specified, DataEase returns the value in the highest
numbered choice (not necessarily the highest ASCII value).
Example
for MEMBERS ;
list records
LASTNAME in order ;
highest of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) for each MEMBERS record, find all the related records in the
RESERVATIONS table (those that have a matching MEMBER ID), and (3) list the highest TOTAL DUE in the set of matching RESERVATIONS records.
The output from this script, arranged in alphabetical order by LAST NAME, might look as follows:
Last Name
Highest of Reservations Total Due
\$3000.00
Albert
Anders
Andersen
...
\$4760.00
\$4420.00
\$2100.00
...
If you also want to include the highest TOTAL DUE among this group of invoices, change the fourth line of the query to read:
highest of RESERVATIONS TOTAL DUE : item max .
Note: There's an important difference between the statistical operator max and the relational statistical operator highestof. max finds the highest value in the specified field among all the records
being processed. highest of finds the highest value among the records related to the records being processed.
Examples:
Example 1
In a field derivation.Simplest type. We have two tables. ThisTable and MyCustomers. We have no relationships defined.
highest of MyCustomers TotalInvoiced
This will return the highest invoiced Total that I have invoiced all my customers.
Example 2
We have two tables.CustomerType and MyCustomers. We have a relationship between them that connect CustomerType and MyCustomers on customer type.There is no
Unique Alternative Name for the Relationship. I have 300 records in MyCustomer and 45 of type Good Credit. My best customer with Good Credit have been invoiced \$3200
and the best customer overall have been invoiced \$5000.
My active record in CustomerType is the Good Credit record.
highest of MyCustomers TotalInvoiced
This will return the number \$3200 as I am now using the relationship instead of the table.
highet of MyCustomers named "AllRecords"
This will return the number \$5000 as I have now defined a unique relationship with no restriction and I will get the total invoiced across the table..
Example 3
highest of MyCustomers named "NewRel" with RegistrationDate=current date TotalInvoiced
This will return the highest invoiced total today
Example 4
for MEMBERS ;
list records
LASTNAME in order ;
highest of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) for each MEMBERS record, find all the related
records in the RESERVATIONS table (those that have a matching MEMBER ID), and (3) list the highest TOTAL DUE in the set of matching RESERVATIONS records.
The output from this script, arranged in alphabetical order by LAST NAME, might look as follows:
Last Name
Highest of Reservations Total Due
\$3000.00
Albert
\$4760.00
Anders
\$4420.00
Andersen
\$2100.00
...
...
If you also want to include the highest TOTAL DUE among this group of invoices, change the fourth line of the query to read:
highest of RESERVATIONS TOTAL DUE : item max .
Note: There's an important difference between the statistical operator max and the relational statistical operator highestof. max finds the highest value in the specified field
among all the records being processed. highest of finds the highest value among the records related to the records being processed.
Se Also:
Count Of Sum Of Lowest Of Mean Of
Function::DateTime
Hours
Usage:
Hours(TIME VALUE) Hours(12:00:00) Hours(MyTimeField)
Purpose:
The hours function extracts the hour from a time value expressed in a 24-hour format.
Return value:
An integer value from 00 to 23.
Content:
hours
Type
Time Function
Purpose
The hours function extracts the hour from a time value expressed in a 24-hour format.
Syntax
hours( TIME VALUE)
Returns
An integer value from 00 to 23.
Examples
hours(12:00:00) {midday}
Returns:12
hours(23:59:00) {one minute before midnight}
Returns:23
Note: The bracketed text above (e.g., midday) is used to clarify the time of day only; it is not one of the function's parameters.
Examples:
Examples
hours(12:00:00) {midday}
Returns:12
hours(23:59:00) {one minute before midnight}
Returns:23
Note: The bracketed text above (e.g., midday) is used to clarify the time of day only; it is not one of the function's parameters.
Se Also:
Minutes Seconds
Function::Internal
HtmlToPDF
Usage:
htmltopdf [GLOBAL OPTION]... [OBJECT]... To convert a remote HTML file to PDF: htmltopdf http://www.google.com google.pdf To convert a local HTML file to PDF: htmltopdf
my.html my.pdf You can also convert to PS files if you like: htmlt
Purpose:
htmltopdf is able to put several objects into the output file, an object is either a single webpage, a cover webpage or a table of content. The objects are put into the output
document in the order they are specified on the command line, options can be specified on a per object basis or in the global options area. Options from the Global Options
section can only be placed in the global options area
A page objects puts the content of a singe webpage into the output document.
(page)? <input url/file name> [PAGE OPTION]...
Options for the page object can be placed in the global options and the pageoptions areas. The applicable options can be found in the Page Options and Headers And Footer
Options sections.
A cover objects puts the content of a singe webpage into the output document, the page does not appear in the table of content, and does not have headers and footers.
cover <input url/file name> [PAGE OPTION]...
All options that can be specified for a page object can also be specified for a cover. A table of content object inserts a table of content into the output document.
toc [TOC OPTION]...
All options that can be specified for a page object can also be specified for a toc, further more the options from the TOC Options section can also be applied. The table of
content is generated via XSLT which means that it can be styled to look however you want it to look. To get an aide of how to do this you can dump the default xslt document by
supplying the --dump-default-toc-xsl, and the outline it works on by supplying --dump-outline, see the Outline Options section.
Return value:
Content:
Examples:
Se Also:
Function::Conditional
If Function
Usage:
if( CONDITION, TRUE VALUE, FALSE VALUE) if(MyUser=current useer name, concat("This is correct", current user name),concat("This is wrong , current user name))
if(a=b,c,d)
Purpose:
The if function evaluates a specified condition and returns one of two specified values based on whether the condition is true or false.
In a field Derivation formula, you can use the if function to:
derive a field value based on one of two specified values or expressions depending on whether a condition is true or false (see Example 1).
In a Validation formula, you can use the if function to:
check a field's validity based on one of two specified expressions depending on whether a condition is true or false (see Example 2).
When you use an if function in a Derivation or Validation formula, the true value and false value parameters must be of the same data type as the field being derived or
validated.
In a script, you can use the if function to:
assign one of two specified values to a field or variable based on whether the condition is true or false (see Example3).
hide or show a field, calculated value, or text string in a procedure's output depending on whether a condition is true or false (see Example 4).
A script, Derivation formula, or Validation formula may have multiple if function statements nested within one another.
Return value:
The true value if the specified condition is true. The false value if the specified condition is false.
Content:
if Function
Type
Conditional Function
Purpose
The if function evaluates a specified condition and returns one of two specifiedvaluesbased on whether the condition is true or false.
Syntax
if(CONDITION, TRUE VALUE, FALSE VALUE)
Returns
The truevalueif the specified condition is true. The falsevalueif the specified condition is false.
Usage
In a field Derivation formula, you can use the if function to:
derive a fieldvaluebased on one of two specifiedvaluesor expressions depending on whether a condition is true or false (see Example 1).
In a Validation formula, you can use the if function to:
check a field's validity based on one of two specified expressions depending on whether a condition is true or false (see Example 2).
When you use an if function in a Derivation or Validation formula, the truevalueand falsevalueparameters must be of the same data type as the field being derived or validated.
In ascript, you can use the if function to:
assignone of two specifiedvaluesto a field orvariablebased on whether the condition is true or false (see Example3).
hide or show a field, calculatedvalue, or text string in a procedure'soutputdepending on whether a condition is true or false (see Example 4).
Ascript, Derivation formula, or Validation formula may have multiple if function statements nested within one another.
Example 1
Using the if function in a Derivation formula:
The following example shows the iffunction used to derive thevaluein a Text field. The function returns one of two textvaluesdepending on the current time in the computer's
system clock.
if(ampm(current time)="AM","in the morning",
"in the afternoon")
Because this Derivation formula returns avaluefor a Text field, the truevalue("in the morning") and the falsevalue("in the afternoon") are both text expressions.
The following example shows the iffunction used in a Derivation formula for a Number field named DISCOUNT. The formula returns one of two DISCOUNTvaluesdepending
on thevaluein another field, TOTAL DUE.
if(TOTAL DUE>=500, TOTAL DUE*0.15, TOTAL DUE*0.03)
This formula evaluates thevaluein the TOTAL DUE field. If thatvalueis greater than or equal to \$500 (making the condition true), the formula sets thevalueof DISCOUNT to
TOTAL DUE * 0.15 If thevalueof TOTAL DUE is less than \$500 (making the condition false), the formula sets thevalueof DISCOUNT to TOTAL DUE * 0.03.
By nesting if statements inside one another, you candefinea Derivation formula that evaluates multiple conditions and returns one of severalvalues. The example below shows
how one if statement can be nested inside another to return one of three DISCOUNTvaluesdepending on thevaluein the TOTAL DUE field:
if(TOTAL DUE>=500, TOTAL DUE*0.15,
if(TOTAL DUE>=200, TOTAL DUE*0.08, TOTAL DUE*0.03))
This formula evaluates thevaluein the TOTAL DUE field. If thatvalueis greater than or equal to \$500 (making the condition true), the formula sets thevalueof DISCOUNT to the
TOTAL DUE multiplied by 0.15. If thevalueis less than \$500 (making the condition false), a second if statement evaluates TOTAL DUE to determine if itsvalueis greater than or
equal to \$200. If this second condition is true, thevalueof DISCOUNT is set to the TOTAL DUE multiplied by 0.08. Otherwise DISCOUNT is set to TOTAL DUE * 0.03.
Example 2
Using the if function in a Validation formula:
The example below shows how the if function can be used in a Validation formula to conditionally apply one of two validation criteria to a field named CREDIT PURCHASES.
if(OVERDUE DAYS<90, <=5000, <50)
This Validation formula evaluates thevaluein a field named OVERDUE DAYS (this field tracks a customer's past-due invoices). If thatvalueis less than 90 (meaning the
customer has no invoices over 90 days past due), then anyvalueup to \$5000 is valid in the CREDIT PURCHASES field. If thevalueof OVERDUE DAYS exceeds 90, then only up
to \$50 can be saved in the CREDIT PURCHASES field.
Example 3
Using the if function toassignavaluein a DQLscript:
The examples below show how to use the if function in a DQLscriptto conditionallyassignavalueto a field orvariabledepending on whether a condition is true or false.
modify recordsinRESERVATION AGENTS
BONUS:=if(SALES>80000, 1000, 0).
Thisscriptassigns avalueto the BONUS field in all RESERVATION AGENTS records. If an employee generated more than \$80,000 in sales last quarter, thevaluein the BONUS
field is set to 1000. Otherwise thevalueof BONUS is set to zero.
The following line shows the if function used toassignavalueto atemporaryvariablein a DQLscript:
assigntempBONUS:=if(SALES>80000, 1000, 0).
Example 4
You can use the if function to conditionally display fields, calculatedvalues, or text strings in theoutputof a DQL procedure. Thescriptbelow uses the if function to display the
SALARY field in a procedure's printedoutputonly if the procedure is run by a specific user:
forEMPLOYEES;
list records
LAST NAMEin order;
FIRST NAME;
JOB TITLE;
if(current user name="Moe", SALARY, BLANK).
end
Thisscripttells DataEase: (1) For each record in the EMPLOYEES table, list the LAST NAME, FIRST NAME, and JOB TITLE, (2) evaluate the current user name systemvariable,
and if the current user is Moe, list each employee's SALARY along with his/her other data, (3) otherwise, do not list the SALARY field.
Examples:
Example 1
Using the if function in a Derivation formula:
The following example shows the iffunction used to derive the value in a Text field. The function returns one of two text values depending on the current time in the computer's
system clock.
if( ampm( current time) = "AM" , " in the morning " , "in the afternoon" )
Because this Derivation formula returns a value for a Text field, the true value ("in the morning") and the false value ("in the afternoon") are both text expressions.
The following example shows the iffunction used in a Derivation formula for a Number field named DISCOUNT. The formula returns one of two DISCOUNT values depending
on the value in another field, TOTAL DUE.
if( TOTAL DUE >= 500, TOTAL DUE * 0.15, TOTAL DUE * 0.03)
This formula evaluates the value in the TOTAL DUE field. If that value is greater than or equal to \$500 (making the condition true), the formula sets the value of DISCOUNT to
TOTAL DUE * 0.15 If the value of TOTAL DUE is less than \$500 (making the condition false), the formula sets the value of DISCOUNT to TOTAL DUE * 0.03.
By nesting if statements inside one another, you can define a Derivation formula that evaluates multiple conditions and returns one of several values. The example below
shows how one if statement can be nested inside another to return one of three DISCOUNT values depending on the value in the TOTAL DUE field:
if( TOTAL DUE >= 500, TOTAL DUE * 0.15,
if( TOTAL DUE >= 200, TOTAL DUE * 0.08, TOTAL DUE * 0.03) )
This formula evaluates the value in the TOTAL DUE field. If that value is greater than or equal to \$500 (making the condition true), the formula sets the value of DISCOUNT to
the TOTAL DUE multiplied by 0.15. If the value is less than \$500 (making the condition false), a second if statement evaluates TOTAL DUE to determine if its value is greater
than or equal to \$200. If this second condition is true, the value of DISCOUNT is set to the TOTAL DUE multiplied by 0.08. Otherwise DISCOUNT is set to TOTAL DUE * 0.03.
Example 2
Using the if function in a Validation formula:
The example below shows how the if function can be used in a Validation formula to conditionally apply one of two validation criteria to a field named CREDIT PURCHASES.
if( OVERDUE DAYS < 90, <=5000, <50)
This Validation formula evaluates the value in a field named OVERDUE DAYS (this field tracks a customer's past-due invoices). If that value is less than 90 (meaning the
customer has no invoices over 90 days past due), then any value up to \$5000 is valid in the CREDIT PURCHASES field. If the value of OVERDUE DAYS exceeds 90, then only
up to \$50 can be saved in the CREDIT PURCHASES field.
Example 3
Using the if function to assign a value in a DQL script:
The examples below show how to use the if function in a DQL script to conditionally assign a value to a field or variable depending on whether a condition is true or false.
modify records in RESERVATION AGENTS
BONUS := if( SALES > 80000, 1000, 0) .
This script assigns a value to the BONUS field in all RESERVATION AGENTS records. If an employee generated more than \$80,000 in sales last quarter, the value in the
BONUS field is set to 1000. Otherwise the value of BONUS is set to zero.
The following line shows the if function used to assign a value to a temporary variable in a DQL script:
assign temp BONUS := if( SALES > 80000, 1000, 0) .
Example 4
You can use the if function to conditionally display fields, calculated values, or text strings in the output of a DQL procedure. The script below uses the if function to display the
SALARY field in a procedure's printed output only if the procedure is run by a specific user:
for EMPLOYEES ;
list records
LAST NAME in order ;
FIRST NAME ;
JOB TITLE ;
if( current user name = "Moe" , SALARY, BLANK) .
end
This script tells DataEase: (1) For each record in the EMPLOYEES table, list the LAST NAME, FIRST NAME, and JOB TITLE, (2) evaluate the current user name system variable,
and if the current user is Moe, list each employee's SALARY along with his/her other data, (3) otherwise, do not list the SALARY field.
Se Also:
if Command case while for
Function::Internal
IndexUpdate
Usage:
IndexUpdate("Tablename") IndexUpdate("Switch") IndexUpdate("CustomerTable") IndxUpdtate("Off") RetVal := IndexUpdate("Quick") .
Purpose:
DataEase in "default" mode will update index after each record modification. This insure consistency and immediate "correct" index but when one run a big update this will be
stealing a lot of processing power and will be the main reason for slow performance.
IndexUpdate function has to main purposes:
1. For developers to insure that a index is consistent before a major update/transaction so records are not left out without having to resort to reorganizing a table.
2. For developers to temporary disable index updating for big transactions to speed up performance and then simply build the index at the end of the transaction.
IndexUpdate() has three modes:
On (Full): Default
This mode will update the index after each updated row.
Quick:
This mode will update the index for each transaction. A transaction is a update of one table (relationship). DO NOT USE THIS MODE IF YOU ARE DOING NESTED
Off:
This is the ADVANCED (Manual) mode. If you use this the index will not be updated at all. This will leave the index "wrong" until you manually update it with
IndexUpdate("YourTableName").
This is the best mode to use if you are doing heavy nested transactions. Just make sure you update manually the indexes for all tables involved in the transaction.
NB! When you have used any other mode then ON(Full) you need to revert to ON at the end of your DQL if not all DQLs in your session will keep on running in the last used
mode.
Return value:
Nothing
Content:
Examples:
Exanple 1:
This sample will simply update the index before doing a transaction, then switch it off and then updated it again:
define "startTime" time .
define "retval" text .
define "counter" number.
counter := 0 .
retval := IndexUpdate("SomeData") . -- Update the index to insure it is current. This is normally not necessary.
retval := IndexUpdate("Off) . -- Switch off Index Updating from her..
startTime := current time .
For SomeData ;
modify records in SomeData named "Drozd" with RecordNr = SomeData RecordNr
SomeText := concat(counter," This is changed!" ).
counter := counter + 1 .
end
retval :=IndexUpdate("On") . -- Switch index updating back to normal.
retval := IndexUpdate("SomeData") . -- Manually update the index.
message concat("Modify took : ", current time-starttime, " seconds.") window .
This DQL on a table of 100.000 records ran 111 times faster than the same DQL in 8.2 and 12.5 times faster then the same DQL in 8.5 Default mode. This DQL took 24
minutes in 8.2, 2 minutes in 8.5 Normal and 13 SECONDS in 8.5 Afterburner.
If you used Quick mode on this DQL you would basically KILL your computer. IndexUpdate on this table took 8 seconds (so the change took only 5!), but if you had used quick
you would have gotten 100.000 x 8 seconds, so it would have taken 92 DAYS. This just to illustrate when to use On (Normal), Quick, and Off/Manual.
Example 2:
This sample will showcase quick, which is designed to speed up linear transactions i.e. big updates/insert/deletes into one table with one With statement.
define "startTime" time .
define "retval" text .
startTime := current time .
for SomeData with SomeText = data-entry field1 ;
delete records .
end
retval := IndexUpdate("On") .
message concat("Delete took : ", current time-starttime, " seconds.") window .
retval := formclear() .
This DQL took 1 second on 100.000 records, when the Full (Default) mode took 37 sec. In reference DE8.2 would take 132 seconds.
Quick was designed as an easy way of controlling speed for big linear transactions and it is amazing when used right, but as it is easy to use it wrong (as illustrated in
example 1) you might want to go fully manual and use Off/IndexUpdate(TableName) which will give the best performance overall.
Se Also:
Function::Mathematical
Installment
Usage:
Installment(PRESENTVALUE,FUTUREVALUE,RATE,PERIODE) Installment(NUMERIC VALUE,NUMERIC VALUE,NUMERIC VALUE,NUMERIC VALUE)
Installment(15000,0,10/12,60)
Purpose:
The installment function calculates the periodic installment payment required for a financial transaction given the presentvalue, futurevalue, interest rate, and number of
payment periods.
If the installment payment increases the value of the investment (e.g., an annuity), the numeric value returned by the function is expressed as a positive amount. If the payment
decreases the value of the investment (e.g., loan amortization), the numeric value returned by the function is expressed as a negative amount. The interest rate, installment
payments, and time periods must be based on the same terms. For example, if payments are made monthly on a five-year loan, the number of periods is (12 * 5) or 60. The
interest rate must be expressed in the same terms (the monthly interest rate is the annual rate /12). When typing fractions like 10 / 12, DataEase requires that you type a space
before and after the / division symbol.
Return value:
A numeric value (the installment payment amount).
Content:
installment
Type
Financial Function
Purpose
The installment function calculates the periodic installment payment required for a financial transaction given the presentvalue, futurevalue, interest rate, and number of payment periods.
Syntax
installment( presentvalue, futurevalue, rate, periods)
Returns
A numeric value (the installment payment amount).
Usage
If the installment payment increases the value of the investment (e.g., an annuity), the numeric value returned by the function is expressed as a positive amount. If the payment decreases
the value of the investment (e.g., loan amortization), the numeric value returned by the function is expressed as a negative amount. The interest rate, installment payments, and time periods must
be based on the same terms. For example, if payments are made monthly on a five-year loan, the number of periods is (12 * 5) or 60. The interest rate must be expressed in the same terms (the
monthly interest rate is the annual rate /12). When typing fractions like 10 / 12, DataEase requires that you type a space before and after the / division symbol.
Example 1
installment( 15000, 0, 10 / 12, 60 )
Returns:-318.71
This example calculates the monthly installment payment required to pay off a \$15,000 loan in 5 years at an annual interest rate of 10%.
Example 2
installment( 0, 15000, 10 / 12, 60)
Returns:193.71
This example calculates the monthly installment amount required to accumulate \$15,000 in 5 years at an annual interest rate of 10%.
Note: DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ((1 + (rate/100))) ** periods) + (installment/(rate/100)) * (((1 + (rate/100)) ** periods) - 1)
Examples:
Example 1
installment( 15000, 0, 10 / 12, 60 )
Returns:-318.71
This example calculates the monthly installment payment required to pay off a \$15,000 loan in 5 years at an annual interest rate of 10%.
Example 2
installment( 0, 15000, 10 / 12, 60)
Returns:193.71
This example calculates the monthly installment amount required to accumulate \$15,000 in 5 years at an annual interest rate of 10%.
Note: DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ((1 + (rate/100))) ** periods) + (installment/(rate/100)) * (((1 + (rate/100)) ** periods) - 1)
Se Also:
FutureValue Presentvalue Percent Power Rate
Function::String
JoinText
Usage:
Jointext(TEXT VALUE, TEXT VALUE) Jointext(TextField,NumberField) Jointext("This is my name: ", current user name)
Purpose:
The jointext function combines two separate text values into one.
When two text values are joined, leading spaces are maintained but trailing spaces are deleted. To join three or more fields, you can use additional jointext functions as either
or both parameters.
Return value:
A text value up to 255 characters in length.
Content:
jointext
Type
Text Function
Purpose
The jointext function combines two separate text values into one.
Syntax
jointext( TEXT VALUE1, TEXT VALUE2)
Returns
A text value up to 255 characters in length.
Usage
When two text values are joined, leading spaces are maintained but trailing spaces are deleted. To join three or more fields, you can use additional jointext functions as either or both parameters.
Examples
jointext( "Sapph" , "ire" )
Returns: Sapphire
jointext( jointext( "Sapph" , "ire" ) , "International" )
Returns: Sapphire International.
In the above example, there is a space at the start of the string International.
jointext( PRODUCT , " for Windows" )
Returns: DataEase for Windows
In the above example, there is a space at the start of the string for Windows. The PRODUCT field holds the value DataEase.
Examples:
Examples
jointext( "Sapph" , "ire" )
Returns: Sapphire
jointext( jointext( "Sapph" , "ire" ) , "International" )
Returns: Sapphire International.
In the above example, there is a space at the start of the string International.
jointext( PRODUCT , " for Windows" )
Returns: DataEase for Windows
In the above example, there is a space at the start of the string for Windows. The PRODUCT field holds the value
Se Also:
ConCat MemoCopy MemoMemoCopy
Function::DateTime
Julian
Usage:
Julian(DATE VALUE) Julian(Current Date) Julian(24/12/12)
Purpose:
The julian function converts a date value to a Julian date.
YY are the last two digits of the year. DDD is the position of the day in the year (with January 1st = 001; and December 31 = 365, except in leap year when it is 366).
Return value:
A five-digit integer in the format YYDDD.
Content:
julian
Type
Date Function
Purpose
The julian function converts a date value to a Julian date.
Syntax
julian( DATE VALUE)
Returns
A five-digit integer in the format YYDDD.
Usage
YY are the last two digits of the year. DDD is the position of the day in the year (with January 1st = 001; and December 31 = 365, except in leap year when it is 366).
Examples
julian( 07/04/99)
Returns: 99185
julian( 12/31/99)
Returns: 99365
Examples:
Examples
julian( 07/04/99)
Returns: 99185
julian( 12/31/99)
Returns: 99365
Se Also:
Date Day Month Year
Function::Internal
LabelExecDQL
Usage:
LabelExecDQL("LabelName",DataEntryValue1,DataEntryValue3,DataEntryValue3,DataEntryValue4,"ExportFilePath") LabelExecDQL("DQLLabel","","","","","") retval :=
LabelExecDQL("MyDQLLabel",Field1,"","","","C:\export.txt")
Purpose:
LabelExecDQL() is part of the ExecDQL library and is complimentary to MemoExecDQL() etc. LabelExecDQL will execute the DQL script that is stored in a label in a document.
One of the challenges with ExecDQL is to store the DQL in the form from where you want to execute it. Especially if the DQL is of any size.
ExecDQL is limited to 255 charcters and even though it was much improved with the introduction of ESCAPE characters, it is still quite limited as you have to write the DQL on
one line in a derivation etc.
So the Big Hitter in the ExecDQL department has been MemoExecDQL(). It is brilliant as you use the strong DE relational behaviour in combination with virtual Memo fields to
lookup the DQL from a DQL storage (table) anywhere in your app. It is great since you can share a DQL between different parts of your APP, but it is limiting in the way you have
to build the Relational structure and as well edit the DQL out of context.
With LabelExecDQL you can simply write the DQL into the form as a text (label) and then execute it by reference it via its Object Name.
Obviously its not very nice to have a big ugly DQL written into your form, but that is easily resolved by executing a SetState("LabelName",0) somewhere on startup.
Return value:
Nothing
Content:
Examples:
Se Also:
ExecDQL
MemoExecDQL
FileExecDQL
Function::String
LastC
Usage:
LastC(TEXT VALUE,n) LastC("My string",3) LastC(TextField1,Length)
Purpose:
The lastc function extracts a specified number of characters from the end (right) of a text value.
lastc(FIELDNAME, 1) returns the last character in the field. Trailing spaces are ignored. If there are n or fewer characters in the field, lastc returns the original text value.
Return value:
A text value n characters in length.
Content:
lastc
Type
Text Function
Purpose
The lastc function extracts a specified number of characters from the end (right) of a text value.
Syntax
lastc( TEXT VALUE, n)
Returns
A text value n characters in length.
Usage
lastc(FIELDNAME, 1) returns the last character in the field. Trailing spaces are ignored. If there are n or fewer characters in the field, lastc returns the original text value.
Examples
lastc( "DataEase" , 4)
Returns: Ease
Returns: EASE
lastc( FIRST NAME, 4)
Returns:The last four characters in the FIRST NAME field for every record that is processed. If the FIRST NAME field contains the value Roger, the function returns oger.
Examples:
Examples
lastc( "DataEase" , 4)
Returns: Ease
Returns: EASE
lastc( FIRST NAME, 4)
Returns:The last four characters in the FIRST NAME field for every record that is processed. If the FIRST NAME field contains the value Roger, the function returns oger.
Se Also:
FirstW FirstC > LastW MidC MidW TextPos
Function::String
LastFirst
Usage:
LastFirst(TEXT VALUE) LastFirst("Scrooge MacDuck") LastFirst(MyTextField)
Purpose:
The lastfirst function converts a text value from the format: First Name [M.] Last Name to the format: Last Name, First Name [M.].
Where [M.] is an optional middle initial.
The name of this function and the firstlast function refer to the format in which the names are stored in a single field.
Return value:
A text value. The contents of the field are rearranged so that the last word (i.e.,the last name) becomes the first word in the returned value. A comma is automatically inserted
after the last name. Where [M.] is an optional middle initial.
Content:
lastfirst
Type
Text Function
Purpose
The lastfirst function converts a text value from the format: First Name [M.] Last Name to the format: Last Name, First Name [M.].
Where [M.] is an optional middle initial.
Syntax
lastfirst( TEXT VALUE)
Returns
A text value.
The contents of the field are rearranged so that the last word (i.e.,the last name) becomes the first word in the returned value. A comma is automatically inserted after the last name.
Usage
The name of this function and the firstlast function refer to the format in which the names are stored in a single field.
Examples
lastfirst( Susan B. Anthony)
Returns: Anthony, Susan B.
lastfirst( T.S. Eliot)
Returns: Eliot, T.S.
lastfirst( FULL NAME)
Returns:The value in the FULL NAME field in the format shown above for every record that is processed. If a record contains the value Roger Birnbaum in the FULL NAME field, the function
returns Birnbaum, Roger.
Examples:
Examples
lastfirst( Susan B. Anthony)
Returns: Anthony, Susan B.
lastfirst( T.S. Eliot)
Returns: Eliot, T.S.
lastfirst( FULL NAME)
Returns:The value in the FULL NAME field in the format shown above for every record that is processed. If a record contains the value Roger Birnbaum in the FULL NAME field,
the function returns Birnbaum, Roger.
Se Also:
FirstLast FirstW LastW MidW StringFind StringReplace
Function::String
LastW
Usage:
LastW(TEXT VALUE,n) LastW("My long sentence with a lot of words",3) LastW(MyTextField,NumberOfWordsFromEnd)
Purpose:
The lastw function extracts a specified number of words from the end (right) of a text value.
lastw(FIELDNAME, n) returns the last n words in the field including intervening spaces and punctuation symbols. If there are n or fewer words in the field, lastw returns the
original text value.
Return value:
A text value n words in length.
Content:
lastw
Type
Text Function
Purpose
The lastw function extracts a specified number of words from the end (right) of a text value.
Syntax
lastw( TEXT VALUE, n)
Returns
A text value n words in length.
Usage
lastw(FIELDNAME, n) returns the last n words in the field including intervening spaces and punctuation symbols. If there are n or fewer words in the field, lastw returns the original text value.
Examples
lastw( "Sapphire International Ltd." , 2)
Returns: International Ltd.
lastw( STREET, 2)
Returns:The last two words in the STREET field for every record that is processed. If a record contains the value "540 Avenida de los Delfines" in the STREET field, the function returns "los
Delfines".
Examples:
Examples
lastw( "Sapphire International Ltd." , 2)
Returns: International Ltd.
lastw( STREET, 2)
Returns:The last two words in the STREET field for every record that is processed. If a record contains the value "540 Avenida de los Delfines" in the STREET field, the function
returns "los Delfines".
Se Also:
FirstLast LastFirst MidW FirstW
Function::String
Length
Usage:
Length(TEXT VALUE) Length("My long text string") Length(TextField)
Purpose:
The length function counts the number of character positions in a text value.
The length function counts all characters, including leading and trailing spaces.
Return value:
An integer value.
Content:
length
Type
Text Function
Purpose
The length function counts the number of character positions in a text value.
Syntax
length( TEXT VALUE)
Returns
An integer value.
Usage
The length function counts all characters, including leading and trailing spaces.
Examples
length( "Sapphire International Ltd." )
Returns: 27
length( "Columbus Island" )
Returns: 15
length( COMPANY NAME)
Returns: The number of characters in the COMPANY NAME field for every record that is processed. If the COMPANY NAME field contains the value Club ParaDEASE, Inc., the function returns20.
Examples:
Examples
length( "Sapphire International Ltd." )
Returns: 27
length( "Columbus Island" )
Returns: 15
length( COMPANY NAME)
Returns: The number of characters in the COMPANY NAME field for every reco
Se Also:
MemoLength MemoWordCount
Function::Mathematical
Log
Usage:
Log(NUMERIC VALUE) Log(3) Log(MyNumberField)
Purpose:
The log function computes the natural base e logarithm of a numeric value.
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Return value:
A numeric value.
Content:
log
Type
Scientific Function
Purpose
The log function computes the natural base e logarithm of a numeric value.
Syntax
log( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
log( 3)
Returns: 1.098612
log( 0.5)
Returns -0.693147
Examples:
Examples
log( 3)
Returns: 1.098612
log( 0.5)
Returns -0.693147
Se Also:
Log10
Function::Mathematical
Log10
Usage:
Log10(NUMERICAL VALUE) Log10(3) Log10(MyNumberField)
Purpose:
The log10 function computes the common base 10 logarithm of a numeric value.
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Return value:
A numeric value.
Content:
log10
Type
Scientific Function
Purpose
The log10 function computes the common base 10 logarithm of a numeric value.
Syntax
log10( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
log10( 3)
Returns: 0.477121
log10( 0.5)
Returns: -0.301031
Examples:
Examples
log10( 3)
Returns: 0.477121
log10( 0.5)
Returns: -0.301031
Se Also:
Log
Function::Action
LookupTo
Usage:
LookupTo("Tablename") retval := LookupTo("MyTable") LookupTo("") -- Display Related Documents Dialogue
Purpose:
Displays the Lookup dialog if a table is specified. If no table is specified the Table dialog displays first.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::String
Lower
Usage:
Lower(TEXT VALUE) Lower("My Camel Case TEXT) Lower("MY CAPITAL TEXT") Lower(MyTextField)
Purpose:
The lower function converts each letter in a specified text value into lower-case type.
Return value:
The specified text value with all the letters in lower case.
Content:
lower
Type
Text Function
Purpose
The lower function converts each letter in a specified text value into lower-case type.
Syntax
lower( TEXT VALUE)
Returns
The specified text value with all the letters in lower case.
Examples
lower( "DataEase" )
Returns: dataease
lower( LAST NAME)
Returns: The value in the LAST NAME field in lower-case type for every record that is processed. If a record contains the value Birnbaum in the LAST NAME field, the function returns birnbaum.
Examples:
Examples
lower( "DataEase" )
Returns: dataease
lower( LAST NAME)
Returns: The value in the LAST NAME field in lower-case type for every record that is processed. If a record contains the value Birnbaum in the LAST NAME field, the function
returns birnbaum.
Se Also:
Proper Upper StringReplace MemoReplace
Function::Internal
Lowest Of
Usage:
lowest of RELATIONSHIP colum lowest of TABLENAME column Syntax: lowest of TABLENAME|RELATIONSHIP [ named "UNIQUE RELATIONSHIP NAME" ] [ with {selection
criteria} ] FIELDNAME
Purpose:
The lowest of operator finds the smallest value in the specified field in all matching records in a related table. The result can appear as a list item in the detail area of a report
or as a statistic at the end of each group or at the end of the report.
There's an important difference between the statistical operator min and the relational statistical operator lowest of. min returns the lowest value in the specified field among
the records being processed. lowest of returns the lowest value in the specified field among the records related to the records being processed.
Return value:
A value of the same type as the specified field. If a Text field is specified, DataEase returns the lowest ASCII value. If a Choice field is specified, DataEase returns the value in
the lowest numbered choice (not necessarily the lowest ASCII value).
Content:
lowest of
Type
Relational Statistical Operator
Purpose
The lowest of operator finds the smallest value in the specified field in all matching records in a related table. The result can appear as a list item in the detail area of a report or as a statistic at
the end of each group or at the end of the report.
Syntax
lowest of TABLENAME|RELATIONSHIP
[named "UNIQUE RELATIONSHIP NAME" ] ]
[with ( selection criteria) ] FIELDNAME ;|.
Returns
A value of the same type as the specified field. If a Text field is specified, DataEase returns the lowest ASCII value. If a Choice field is specified, DataEase returns the value in the lowest
numbered choice (not necessarily the lowest ASCII value).
Usage
There's an important difference between the statistical operator min and the relational statistical operator lowest of. min returns the lowest value in the specified field among the records being
processed. lowest of returns the lowest value in the specified field among the records related to the records being processed.
Example
for MEMBERS ;
list records
LAST NAME in order ;
lowest of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) for each MEMBERS record selected, find the related records in the
RESERVATIONS table (those that have the same MEMBERID), and (3) list the lowest TOTAL DUEvalue for each of the matching RESERVATIONS records.
The output from this script arranged in alphabetical order by LAST NAME, might look as follows:
Last Name
Albert
Anders
Anderson...
Lowest of Reservations Total Due
\$2740.00
\$4100.00
\$3690.00
\$1720.00...
If you also want to include the smallest TOTAL DUE among this group of reservations, change the fourth line of the query to read:
lowest of RESERVATIONS TOTAL DUE : item min .
Examples:
Example 1
In a field derivation.Simplest type. We have two tables. ThisTable and MyCustomers. We have no relationships defined.
lowest of MyCustomers TotalInvoiced
This will return the lowest invoiced Total that I have invoiced all my customers.
Example 2
We have two tables.CustomerType and MyCustomers. We have a relationship between them that connect CustomerType and MyCustomers on customer type.There is no
Unique Alternative Name for the Relationship. I have 300 records in MyCustomer and 45 of type Good Credit. My worst customer with Good Credit have been invoiced \$320
and the worst customer overall have been invoiced \$50
My active record in CustomerType is the Good Credit record.
lowest of MyCustomers TotalInvoiced
This will return the number \$320 as I am now using the relationship instead of the table.
lowest of MyCustomers named "AllRecords"
This will return the number \$50 as I have now defined a unique relationship with no restriction and I will get the total invoiced across the table..
Example 3
lowest of MyCustomers named "NewRel" with RegistrationDate=current date TotalInvoiced
This will return the lowest invoiced total today
Example 4
for MEMBERS ;
list records
LAST NAME in order ;
lowest of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) for each MEMBERS record selected, find the
related records in the RESERVATIONS table (those that have the same MEMBERID), and (3) list the lowest TOTAL DUEvalue for each of the matching RESERVATIONS
records.
The output from this script arranged in alphabetical order by LAST NAME, might look as follows:
Last Name
Lowest of Reservations Total Due
\$2740.00
Albert
\$4100.00
Anders
\$3690.00
Anderson...
\$1720.00...
If you also want to include the smallest TOTAL DUE among this group of reservations, change the fourth line of the query to read:
lowest of RESERVATIONS TOTAL DUE : item min .
Se Also:
Count Of Sum Of Highest Of Mean Of
Function::Internal
Mean Of
Usage:
mean of RELATIONSHIP colum mean of TABLENAME column Syntax: mean of TABLENAME|RELATIONSHIP [ named "UNIQUE RELATIONSHIP NAME" ] [ with {selection
criteria} ] FIELDNAME
Purpose:
The mean of operator calculates the average value in a specified field in all matching records in a related table. The result can appear as a list item in the detail area of a
report or as a statistic in the summary area at the end of each group or at the end of the report.
The mean of operator calculates the average value in a specified field in all matching records in a related table. The mean of operator calculates the average of all the values
in the specified field (the sum of the values divided by the number of values processed). Blank fields are ignored. Fields that have a value of zero are included in the
calculation.
There's an important difference between the statistical operator mean and the relational statistical operator mean of. mean finds the average value in the specified field among
the records being processed. mean of finds the average value in the specified field among the records related to the records being processed.
Return value:
A numeric value.
Content:
mean of
Type
Relational Statistical Operator
Purpose
The mean of operator calculates the average value in a specified field in all matching records in a related table. The result can appear as a list item in the detail area of a report or as a statistic in
the summary area at the end of each group or at the end of the report.
Syntax
mean of TABLENAME|RELATIONSHIP
[named "UNIQUE RELATIONSHIP NAME" ]
[with ( selection criteria) ] FIELDNAME ;|.
Returns
A numeric value.
Usage
The mean of operator calculates the average of all the values in the specified field (the sum of the values divided by the number of values processed). Blank fields are ignored. Fields that have
a value of zero are included in the calculation.
There's an important difference between the statistical operator mean and the relational statistical operator mean of. mean finds the average value in the specified field among the records being
processed. mean of finds the average value in the specified field among the records related to the records being processed.
Example
for MEMBERS ;
list records
LAST NAME in order ;
mean of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2)for each MEMBERS record processed, find all the related records in
the RESERVATIONS table (those that have the same MEMBERID), and (3) list the mean TOTAL DUE for each member from the set of related RESERVATIONS records.
The output from this script might look as follows:
Last Name
Albert
Anders
Anderson...
Mean of Reservations Total Due
\$2780.00
\$4430.00
\$4055.00
\$1910.00...
If you also want to include the mean TOTAL DUE among this group of reservations, change the fourth line of the script to read:
mean of RESERVATIONS TOTAL DUE : item mean .
Examples:
Example 1
In a field derivation.Simplest type. We have two tables. ThisTable and MyCustomers. We have no relationships defined.
highest of MyCustomers TotalInvoiced
This will return the highest invoiced Total that I have invoiced all my customers.
Example 2
We have two tables.CustomerType and MyCustomers. We have a relationship between them that connect CustomerType and MyCustomers on customer type.There is no
Unique Alternative Name for the Relationship. I have 300 records in MyCustomer and 45 of type Good Credit. My best customer with Good Credit have been invoiced \$3200
and the best customer overall have been invoiced \$5000.
My active record in CustomerType is the Good Credit record.
highest of MyCustomers TotalInvoiced
This will return the number \$3200 as I am now using the relationship instead of the table.
highet of MyCustomers named "AllRecords"
This will return the number \$5000 as I have now defined a unique relationship with no restriction and I will get the total invoiced across the table..
Example 3
highest of MyCustomers named "NewRel" with RegistrationDate=current date TotalInvoiced
Example
for MEMBERS ;
list records
LAST NAME in order ;
mean of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2)for each MEMBERS record processed, find all
the related records in the RESERVATIONS table (those that have the same MEMBERID), and (3) list the mean TOTAL DUE for each member from the set of related
RESERVATIONS records.
The output from this script might look as follows:
Last Name
Mean of Reservations Total Due
\$2780.00
Albert
\$4430.00
Anders
\$4055.00
Anderson...
\$1910.00...
If you also want to include the mean TOTAL DUE among this group of reservations, change the fourth line of the script to read:
mean of RESERVATIONS TOTAL DUE : item mean .
Se Also:
Count Of Sum Of Highest Of Mean Of
Function::Memo
MemoChunk
Usage:
MemoChunk(MEMO FIELD,NUMERIC VALUE) MemoChunk(MyMemo,3)
Purpose:
To "decompile" or "unwind" a Memo field into 256 long chunks that can be handled by ordinary DataEase functions and saved in Text fields.
Pre DataEase 8 there was no way one could manipulate of use the content of Memo fields. The only way one could add to the was by manually keying in the content and the
only way one could exploit the content was via reading it on screen.
In 8 Memo fields are one of the most important field types and visual controls.
We have added a entirely new class of functions simply to manipulate, populate and extract data from memo fields.
MemoChunk() is a function that will simply retrieve a 256 bytes large chunk from a Memo field and return it as a normal text string(256).
The usage of MemoChunk() can be for saving the content of a Virtual Memo Control into normal text fields for indexing, searching etc.
!Hint to legacy DataEase users!
If you have problems with your old style Memo fields being migrated to new style from 6.5x to 7.x you can use this function to unwind your data back into a Fields structure like
the old style Memos. You can also use the New Style memo for editing and then unwind it back into a standard field structure.
Return value:
Returns a String(256) that contain the content of the chunk indicated by NUMERIC VALUE. If it returns blank, you have come to the end of the memo. The last Chunk of a memo
will be between 1 and 256 bytes long.
Content:
We have now looked at a lot of functions that manipulate,extend, copy and append to a Memo field.
What about "normalising" it again. A lot of you traditionalist, don't and never will trust a memo field, and anyhow, even us "extremists" can't use traditional DataEase functions
on a Memo field.
Maybe there is times we want to unwind a Memo field and save it in a normal DataEase table structure. It is not such a big defeat, we can simply rebuild it if we like with the
MemoMemoCopy Function etc.
Enter MemoChunk().
string(256) MemoChunk(MemoToChunk,Chunk#)
Chunk# is proper Data techy, 0 is the first, 1 is the second, 2 is the third and on we go...Why make it easy?
MemoChunk(MemoToChunk,0) will return the first 256 bytes of the memo field , and MemoChunk(MemoToChunk,1) the next 256 and so we go.
So how do I know when I have reached the end of the Memo?
Firstly this is proper DataEase functionality, it will not GPF even though you try to take a chunk that doesn't exist, so don't worry. It will simply return nothing, like a good little boy,
and this is how you can tell that you have come to the end...
When MemoChunk(MemoToChunk,N) returns blank, it is all over.
Enjoy!
Examples:
Example 1
To make it easy for the example create we say we have a memo that contain a ledger where each entry is exactly 256 characters long ;-)
Each entry start with the number of the entry and then it continues with the name of the person etc.
First entry is 1. Andy MacNicol, born...Entry 40 starts with 40. Peter Cool born... and entry 1143 starts with 1143. Albin Youn born...
MemoChunk(MyMemo,0)
Returns: 1. Andy MacNicol born.... etc for 256 characters.
MemoChunk(MyMemo,39)
Returns: 40. Peter Cool born.... etc...
MemoChunk(MyMemo,1142)
Returns: 1143. Albin Youn born....
(I think you got it now)
Example 2
In this example we see a memo field with a HTMLEdit field control. When the record is saved the content of the memo is split into 4 Text fields by each of the calling.
MemoChunk(MyMemo,0) through MemoChunk(MyMemo,3).
Se Also:
Function::Memo
MemoConsoleCopy
Usage:
MemoConsoleCopy(Memo,Mode) ConsoleCopy(MyMemo,4) ConsoleCopy(MessageField,4) retval := ConsoleCopy(MyMessage,4) (Reason we use 4 in all examples is that
this is append with CR before which is the most meaningful when you add a line to the console)
Purpose:
The console is basically screen print in DFD, and in version 1 it even looks like DOS ;-) The console will have many purposes.
1. You can use it as a DEBUG window and use ConsoleCopy() to put messages on the console during a procedure run instead of Window/Dialog messages.
2. You can use it as a report output the way you used to in DFD. You will have to build your own output, but that is what most of us did in DFD anyway (OUTPUT)
3. You can use it to generate a print or export. You can of course already do that via the new file functions, but this way you will be able to visualise it too. The nice thing with the
console is that it is unique for each application, but there is only one, so you can add stuff to it from anywhere in your application and when happy, you can simply save it to a
file with ConsoleWriteTofile() or print it to a Windows device (printer) with the same function.
Plenty of other uses too, this is just the start.
Return value:
Nothing
Content:
Examples:
Se Also:
ConsoleShow()
ConsoleWriteToFile()
ConsoleCopy()
ConsoleMemoCopy()
Function::Memo
MemoCopy
Usage:
MemoCopy(MemoField,Field,Switch) MemoCopy(MemoField,"Constant",Switch) MemoCopy(MemoField,concat("This is derrived from current username: ",current
username),switch) MemoCopy(MemoField,Field,0) - Append to Memo. MemoCopy(MemoField,Field,1) - Overwrite/Rep
Purpose:
Insert or append a standard DataEase field or string value into a Memo Field.
Memo is a new field class in DataEase 8 with it's own functions to manipulate and bridge the gap between traditional DataEase functionality and Memo. Memo will not work
with standard functions like Jointext(), Concat() etc. because they can only manipulate 246 bytes at a time.
MemoCopy() is designed to insert/append any traditional DataEase value into any Memo field. You can insert it at the beginning, overwrite the Memo, delete/blank the current
value or simply append it at the end.
It is designed to be used for building Memo content dynamically or to manipulate Memo fields by adding content. It can be used both for normal text adding (export etc.) or it can
be used for adding coding like html/CSS etc.
This function can be called from a Button (Action), a derivation (i.e field derivation or validation) or be used as a part of a DQL query to populate a Memo list, export creation,
web page build etc.
Return value:
This function returns only a blank string. All new Manipulation functions will return a blank string so they can be used as part of any derivation.
Content:
MemoCopy
Type
Memo Function
Purpose
Copies, Appends or Inserts a Field or a constant into a Memo field.
This function is part of the Memo manipulation class which bridge the gap between Memo and standard DataEase type fields like Text, Number, Numeric String, Date, Time, Choice etc.
This is a very useful function if you would like to build a document/storage in a Memo field for instance for export, or for presentation in WebField.
Syntax
MemoCopy (MemoToCopyTo,FieldToCopyFrom,Switch)
? MemoToCopy to is the memofield you want to insert,append or overwrite.
? FieldToCopyFrom is the field/constant you want to insert,append to the memo
? Switch is: 0 = Append, 1= Overwrite, 2=Insert at beginning.
Returns
An empty string so the function can be called as a part of any formula without interfering with content of field.
Example
Memofield Body contains: DataEase 8 is great! before we execute function
MemoCopy(Body,"This is a test!",0)
? would result in the content of Body being: DataEase 8 is great! This is a test!
MemoCopy(Body,"This is a test!",1)
? would result in the content of Body being: This is a test!
MemoCopy(Body,"This is a test!",2)
? would result in the content of Body being: This is atest! DataEase 8 is great!
Complimentary Functions
MemoMemoCopy() - same function but copies, inserts or overwrite a Memo with another Memo.
WriteToFile() - Function that will perform the same functionality, but write to a file instead of a Memo.
Chr() - Function that returns the ASCII character for a number, you will need this to insert " or NewLine into a Memo.
MemoWriteToFile() - Same as WriteToFile() but writes, inserts or appends a memo to a file.
Examples:
You will find an extensive example on how to get best use of this function in our Tutorial Database which is shipped with DataEase 8.
For this example we have Memo field MyMemo that contains the text:
"And the winner is"
Example 1
MemoCopy(MyMemo,"Peter Griffin",0)
Result: And the winner is Peter Griffin.
Example 2
MemoCopy(MyMemo,"Peter Griffin",1)
Result: Peter Griffin
Example 3
MemoCopy(MyMemo,"Peter Griffin",2)
Result: <Nothing>
Example 4
MemoCopy(MyMemo,"Peter Griffin",0)
Result: Peter Griffin And the winner is.
Example 5
This example will be a little more practical. Let say we want to insert a new sentence at the beginning i.e a heading. We will combine MemoCopy() with another new function
chr() which will allow you to append any ASCII value as well like CR or ".
MemoCopy(MyMemo,concat("This is the results of the Norwegian Jury!",chr(13),chr(10)),3)+MemoCopy(MyMemo,"Peter Griffin",0)
Result:
The Result of the Norwegian Jury!
And the winner is Peter Griffin.
We see here that we get a carriage return after the new heading. This can be very useful when you are going to build documents etc in Memo fields or diretctly in Text fields
with WriteToFile() etc.
Example 6
This is a real example from our Avanced Email Example in the Default template in 8. Here we combine MemoCopy with the External Function GetFileName the new function
GetCurrent() and the result is quite exhilarating.
MemoCopy(Attachments,concat(GetFileName("","",GetCurrent("MyDocuments")),","),0)
What hapens here is:
1. When we click on the Button Attach File, we get a Select File dialogue that points directly on YOUR My Documents catalogue. You can then browse till you find your
attachment (You can of course add a further structure behind My Documents etc).
2. You select the file you want to attach and click Open.
3. The file name gets appended to the Attachment Field in the Email.
Suddenly the normal limitations of one value in a field etc. is gone. You can attach as many attachments as you please. This list is later written to a file via a virtual field, and
attached via the emailing functionality.
Se Also:
Function::Memo
MemoDecodePair
Usage:
MemoDecodePair(MEMO FIELD,TEXT VALUE) MemoDecodePair(MyMemo,"Customer") MemoDecodePair(MyMemoCoded,LOOKUP MyCodes Code) Syntax of Coded Pair:
[@codename:[email protected]] [@Customer:4ThePeople [email protected]] [@MyMessage:This is a message to all DataEase [email protected]]
Purpose:
To extract a coded value from a value pair inside a Memo field.
DataEase have always been very good at storing structured data and retrieving it. What it has not been so good at is to store and exploit unstructured data or dynamically
generated data.
In DataEase for DOS you had a limited ability with OUTPUT in DQL to create your own Exports and you could decode the import in a DQL but it was always a little awkward and
laborious. In DFW this venue was closed of as well.
DataEase is all about making advanced stuff simple and changing memo from being something dead and dour into something living has been a fun challenge.
When you Pair MemoDecodePair() with MemoCopy(), MemoWriteToFile() and MemoReadFromFile() as a start you have a very exciting tool for importing, exporting, adding and
extracting data from a unstructured format.
Have a look at the example and use your creativity and you will amaze yourself.
Return value:
The matching value for the coded name in TEXT VALUE.
Content:
This might be "greek" for the ones of you that hasn't followed us through the new MemoClass/WebField class project, but for those that have, this will be the last clue to the
riddle.
Over the last couple of months, you have been able to see Memo transferred from something to be avoided, to one of the most important features in "modern" DataEase.
We now use it for saving Web Pages, Building reports, building exports etc etc, and last but not least Importing Data with MemoReadFromFile...
MemoReadFromFile is brilliant to read info back into a memo field so it can be displayed with WebField (Advanced Webfield) further edited with HTMLEdit or simply printed
with PrintMemo(), but one thing have been missing...
What if there is information in there that I want to extract?
Obviously there is functions like MemoFind, that you can use to find a occurrence, but what about extracting information?
This has been a little headache, because how do you limit or tell DataEase what to extract?
We have stole a little from DG3, and we have stole a little from how things are transmitted on the web, and we have come up with MemoDecodePair()
This function will need the data to have been encoded in a certain format as a pair.
[@variablename:[email protected]] ex. [@customername:DataEase International [email protected]]
MemoDecodePair(MemoToScan,"customername") will then return DataEase International Ltd.
The return value of MemoDecodePair is string(256).
So is this useful to me?
We have simply shown a simple extraction, but this can of course be manipulated programatically using all the other DataEase function, so you can unwind a lot of information
in a DQL for instance by adding a sequence number to the variablename, and saving a record for each turn of the wheel...
Use your imagination...we create the functionality, it is your job to exploit it and break it ;-)
Examples:
Example 1
We have a Memo named MyMemo that contains a long and boring text;
...and then we figured out that the companies tax return had been issued on the wrong paper. But [@Customer:4ThePeople Ltd is a great [email protected]] nobody at the Inland
MemoDecodePair(MyMemo,"Customer")
Returns: 4ThePeople Ltd is a great company.
Example 2
Simple and stupid example. We hope that you will be able to use this for something more "useful"
Here we have to editable fields where one enter Customer Name and Address.
We also have a Editable Virtual Memo field (just for fun) where you can type any text.
When you hit the button Encode Memo we append the Code Pairs to the text.
MemoDecodePair will only search through a Memo field till it find the pair in question so if there is more than one matches it will simply find the first one. Try this out by
changing the values of Customer Name and Address and hit Encode Memo again...as many times as you like ;-)
In our example we simple decode the Memo immediately in tow virtual fields:
MemoDecodePair( CodedMemo ,"Customer") & MemoDecodePair( CodedMemo ,"Address")
Examples need to be stupid, it is the law, but please use this for something more creative and useful.
Se Also:
MemoCopy WriteToFile MemoMemoCopy MemoReadFromFile MemoWriteToFile MemoReplace
Function::Memo
MemoExecDQL
Usage:
MemoExecDQL(DQLMemoField,"Data-Entry Field1","Data-Entry Field2","Data-Entry Field3","Data-Entry Field3","Export File") MemoExecDQL(MyMemo,MyDataEntry1)
Purpose:
MemoExecDQL is the most used ExecDQL function simply because you can make your own editor form in an application where you store all your DQLs and then you transfere
them to the form where they are needed via a simple lookup to a virtual memo field.
When it is looked up in the virtual memo field, you can simply execute it in the form via MemoExecDQL().
You can execute a DQL up to 64k in length this way.
Return value:
Nothing
Content:
Examples:
Se Also:
CHR()
GetValue()
ExecDQL()
LabelExecDQL()
TextExecDQL()
StringEscape()
Function::Memo
MemoFind
Usage:
MemoFind(MEMO FIELD, TEXT VALUE) MemoFind(MyMemo,"4ThePeople") MemoFind(MyMemo,MyValuToFind)
Purpose:
Find out if the search string occurs in a Memo field.
Sound simple, is magic! This function will simply return the position in a memo of the first occurrence of a given search string.
The position information might not be so useful, but the fact that it is there is! This is in essence freetext search and you can use it to find out which record contain a certain text
in a memo.
We use this in this help and we use it on our web to search articles etc.
Return value:
a number that indicates where the first occurrence of the search string starts. It returns 0 if a Memo does not contain the search string.
Content:
Such a simple function, but already such an important function.
This is the missing freetext search in DataEase.
As you know, you cannot search Memo fields in DataEase up and including 7.2, but then again Memo is just a Memo...for notes. Nobody want to search them anyway?
In 8, we see that almost 90% of the data in an application is now stored in Memos, simply because you can now save document sized objects, where you before was limited to
256 bytes in "useful" fields.
We quickly realised that we needed to be able to search across memo fields too.
The reason traditional DataEase search doesn't work in Memos, is because of the architecture. A traditional DataEase database is structured, when memos is stored outside
the structure. To change the traditional functions to take Memo into account, would slow down the traditional functionality, when at the same time it wouldn't really be a good
idea.
In 8 we rather add functions that change functionality, so this is what we did here too. We added MemoFind().
int MemoFind(MemoToSearch,Search)
We successfully use this in With statements in DQL, and in filters...works brill, and is the corner stone of search on this website, both in News and Help and...
Enjoy thinking different!
Examples:
Example 1
for NewsArticles with MemoFind(ArticleBody,data-entry searchfield)>0 ;
list records
...
This DQL will return all articles that contain the value we search for!
Cool?
Example 2
You don't need any more do you? You got it!
Se Also:
MemoLength MemoReplace
Function::Memo
MemoGetGlobal()
Usage:
MemoGetGlobal("GlobalMemoVariableName",MemoToSetItIn) MemoGetGlobal("MyStoredMemo",MyMemo)
Purpose:
Return the Memo value set with MemoSetGlobal() and set it into a local Memo Object.
Memos can't be queried the normal way due the the size, so all manipulation and moving around have to be done via Memo Objects.
MemoSetGlobal() will set the content of a local Memo into a Global Memory variable (named) and MemoGetGloba() will retrieve it and insert it into a local Memo fields object.
Return value:
Nothing. -- Result will
Content:
Examples:
Se Also:
Function::Memo
MemoLength
Usage:
MemoLength(MEMO FIELD) MemoLength(MyMemo)
Purpose:
To find out the length (number of characters) in a Memo Field.
Can also be used to figure out if a Memo Field is Blank.
Return value:
Numerical Value. Length of MEMO FIELD.
Content:
Just a simple little function that might be very nice when you start manipulating your Memos.
Forget all the negative stuff you have heard about Memos. They are the greatest thing happening to DataEase since Subforms.
They had a rough start, but that was simply because they had to work like large text fields. THEY ARE NOT!
They are a storage class for unstructured text!
We now use the form WebFields, Datastorage, export, import, you name it they do it.
So it might be useful to know how much is stored in one..
number MemoLength(Memo) simply returns that as a number. 0 obviously is empty, but so is Blank...
Good luck!
Examples:
Example 1
MyMemo contains a Text that is 3250 characters long.
MemoLength(MyMemo)
Returns: 3250.
Example 2
In a Virtual field we find the following formula;
If (MemoLength(MyMemo)>0, MemoCopy(MyMemo,"This field already contains data!".0),MemoCopy("This MemoField was empty!",1))
This formula will result in the text "This field already contains data!" being appended to the MemoField if it already contains data, and "This MemoField was empty!" be inserted
into it if it didn't.
Example 3
The following DQL will return all records where the Memo MyMemo has content.
For MyMemoForm with MemoLength(MyMemo)>0 ;
List records
....
Se Also:
MemoWordCount MemoReplace
Function::Memo
MemoMemoCopy
Usage:
MemoMemoCopy(MEMO FIELD,MEMO FIELD2,NUMERIC VALUE) MemoMemoCopy(MemoField,MemoField2,Switch) MemoMemoCopy(MemoField,MemoField2,0) - Append to
Memo. MemoMemoCopy(MemoField,MemoField2,1) - Overwrite/Rep MemoMemoCopy(MemoField,MemoField2,2) - Delete
Purpose:
Insert, append, overwrite or delete the value of a Memo field with the content of another memo field.
In the new Memo class the essence is to be able to manipulate and "play" with memo fields in any way you like. We have MemoCopy() that works the same way as
MemoMemoCopy() but it simply appends/copies a normal DataEase field rather than a memo.
MemoMemoCopy() allow you to move the information in Memofields around and merge them together.
Return value:
Nothing.
Content:
MemoMemoCopy
Type
Memo Function
Purpose
This function copies, appends, or inserts a Memo into another Memo. This function will make it possible to build an advanced Memo field from many other Memo field.
Same as MemoCopy, just that it copies Memo fields into Memo instead of normal DataEase field types.
Syntax
MemoMemoCopy(MemoTo,MemoFrom,Switch)
? where MemoTo is the result Memo, MemoFrom is the memo to be copied, inserted or appended.
Switch: 0=Append, 1=Overwrite, 2=Insert at beginning.
Returns
An empty string so the function can be used as part of any derrivation without interfering with the derivation result.
Example
Memo1 contains "DataEase" and Memo2 contains "Is great"
MemoMemoCopy(Memo1,Memo2,0)
? will reuslt with the Memo1 containing : DataEase is great
MemoMemoCopy(Memo1,Memo2,1)
? will result with Memo1 containing> is great
MemoMemoCopy(Memo1,Memo2,2)
? will result with Memo1 containing: is great DataEase
Notice that "MyName" has no space, because the trailing space in "My " was truncated. Whereas the words "Name is" are correctly spaced, because the string " is" had a leading space.
The Jointext function is retained, and can still be used.
Complimentary Functions
MemoCopy() - same function but copies, inserts or overwrite a Memo with a normal DataEase field or constant.
WriteToFile() - Function that will perform the same functionality, but write to a file instead of a Memo.
Chr() - Function that returns the ASCII character for a number, you will need this to insert " or NewLine into a Memo.
MemoWriteToFile() - Same as WriteToFile() but writes, inserts or appends a memo to a file.
Examples:
Example 1 - Append
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,0)
Result: This is Memo1This is Memo2
Example 2 - Overwrite
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,1)
Result: This is Memo2
Example 3 - Delete
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,2)
Result: <blank>
Example 4 - Insert
We have to memo fields.
Memo1: This is Memo1
Memo2: This is Memo2
MemoMemoCopy(Memo1,Memo2,3)
Result: This is Memo2This is Memo1
Example 5
This example is from the Send Advanced E-Mail example in the Default Template.
if (MemoLength(Emailbody)>0,MemoCopy(MailBodyCoded,"<div>",1)+MemoMemoCopy(MailBodyCoded,Emailbody,0)+MemoCopy(MailBodyCoded,"
,MailFile,1)+MemoWriteToFile(MailBodyCoded,MailFile,0)+MemoWriteToFile(MySiignature,MailFile,0),0)
This formula builds the Email body.
If Email body is not ampty >
MemoCopy a start HTML <div>
MemoMemoCopy The content of Emailbody to the new MailbodyEncoded
MemoCopy a end HTML </div>
Then we parse through the New MailbodyEncoded and replace all Text carriage returns with proper HTML <br> line break tags.
Then we write the style header to the filepath stored in virtual field Mailfile with overwrite.
Then we append the Encoded Mail body to the Mailfile.
Then we append the Email signature to the mailfile.
And this is the result. Properly formatted properly styled and with Email signature...Voila!
Se Also:
Function::Memo
MemoMemoReplace
Usage:
MemoMemoReplace(LetterTemplate,"[{Signature}]",any ExtendedUser with Username=Current user Signature) .
Purpose:
To replace a tag in a memo with the content of another memo.
Memo manipulation in DE8 is much more tha simple manipulation of text. The Memo in question can be a HTML template, a invoice template, a report template etc. You can
build the template with partly formatted code and partly with tags that will be replaced with content of columns and memos when you build the document.
You can for instance build a letter where you have "custom" headers, footers etc and simply replace the tags when you build the letter or you can build a custom made offer
with full descriptions etc. from a library stored in the database.
Return value:
Nothing.
Content:
Examples:
Se Also:
Function::File
Usage:
Purpose:
To read the content of a text file into a Memo field. You can overwrite the existing Memo Field, Append the content of the file to it or insert the file content at the beginning of the
Memo Field.
It is no secret that Import and Export possibilities has been somewhat "stumped" in DFW. In fact it hasn't bee technically so limited as our users seem to think, but for various
reasons it has been perceived as much more limited than in DFD. This has mostly been down to niggling small bits that shut the functionality away from the users.
MemoReadFromFile() is simply a tool to read any formatted text into a Memo Field. This can be as an import/export feature in combination with MemoDecodePair(), part of
processing in combination with MemoWriteToFile() - You build a text file instead of directly into a Memo Field and then read it back into DataEase via MemoReadFromFile(). It
can be part of using HTML in your App... You decide!
In short this is simply a very flexible FileRead function that you can use for anything you like.
Return value:
Nothing. Result: Will populated MEMO FIELD (Destination Memo) with the content of file in TEXT VALUE. This is a new class of functions called Manipulation Functions which
manipulate another object than the one they are called from.
Content:
This is the complimentary function to MemoWriteToFile, and it simply read the content of a File into a Memo field.
It reads it as Text. If you read an HTML file, it will display as HTML code in a normal Memo Editbox field, and as the Webpage in a WebField.
MemoReadFromFile has the same switches and formating as MemoWriteTo file.
Argument:
0 - Append to Memo.
1 - Overwrite Memo
Examples:
Example 1
We have a memo called MyMemo that contains "This is a test" and a text file MyText.txt that contains "This is a test too!". The text file is located in the app catalogue.
Result in MyMemo: This is a testThis is a test too!
Example 2
We have a memo called MyMemo that contains "This is a test" and a text file MyText.txt that contains "This is a test too!". The text file is located in the app catalogue.
Result in MyMemo: This is a test too!
Example 3
We have a memo called MyMemo that contains "This is a test" and a text file MyText.txt that contains "This is a test too!". The text file is located in the app catalogue.
Result in MyMemo: This is a test too!This is a test
Example 4
We have a Document template stored in [users]/My Documents/DataEase/Templates/. It is a mail merging template that we will mail to the customers. It contains MailMerging
Tags for Customer name.
Next step is to replace the [{Customer}] tag with the content of the field CustomerName
MemoReplace(MyMemo,"[{Customer}]",Customer)
We have now read a document template from a relative catalogue on the current PC and prepared it for printing/mailing.
Se Also:
Function::Memo
MemoReplace
Usage:
MemoReplace(MemoToReplaceIn,StringToReplace,StringToReplaceWith) MemoReplace(MyMemo,"[{custoner}]","DataEase International Ltd")
MemoReplace(MyMemo,MyReplaceField,ReplaceWithField) retval := MemoReplace(MemoToManipulate,"Test","OK") . Memo and String is
Purpose:
To replace all occurrences of a string in a Memo with another string.
Can be used to populate a template with the content of a table etc.
Return value:
Content:
MemoReplace
Type
Memo Function
Purpose
Replaces all occurences of search in a memo with new value. This is possibly one of the most influetial new functions in DataEase 8. This is the function you will use to replace tags in Memos to
create letters, emails, webpages etc.
Syntax
MemoReplace(MemoToReplaceIn,Search,NewValue)
? where MemoToReplaceIn is the result Memo, Search is the value to be replaced and NewValue is the value that will substitute.
Returns
An empty string so the function can be used as part of any derrivation without interfering with the derivation result.
Example
Memo1 contains: "bla bla this is a test etc etc Companyname: [{company}] bla bla bla"
MemoReplace(Memo1,"[{company}]","4ThePeople Limited")
? will reuslt with the Memo1 containing : "bla bla this is a test etc etc Companyname: 4ThePeople Limited bla bla bla"
Complimentary Functions
MemoCopy() - same function but copies, inserts or overwrite a Memo with a normal DataEase field or constant.
WriteToFile() - Function that will perform the same functionality, but write to a file instead of a Memo.
Chr() - Function that returns the ASCII character for a number, you will need this to insert " or NewLine into a Memo.
MemoWriteToFile() - Same as WriteToFile() but writes, inserts or appends a memo to a file.
Examples:
Example 1. (Found in ExecDQLStore in CRM sample)
DQLNr 301 - Generate Labels Avery1
define temp "Telle" number .
define temp "tRow" number .
define temp "tColumn" number .
define temp "tTemporaryID" text .
define temp "retval" text .
define temp "tMCopy" number .
tMCopy := 1 . -- The switch that tell the MemoMemoCopy to Overwrite or append a page. First page is Overwrite, rest is append.
tColumn := 1 . -- Column number in array
tRow := 1 . -- Row number in array.
for Customers with CustomerNR <= data-entry field1 ; -- Here you set the selection criteria for the labels. Lazy so just use CustomerNr < but you can use anything.
if tColumn > 3 then --end of row x, ka-ching new line. Here you can read the 3 as a variable from the Template system instead if you want to make it generic.
tColumn := 1 .
tRow := tRow+1 .
if tRow>6 then -- this is hardcode because we are lazy, you can of course look this up from your template form together with the template.
tRow := 1 .
Telle:=0 .
tMCopy := 0 . -- now 0 because we want to append another page.
end
end
modify records in Temporary with TemporaryID = "Avery1" -- we use a pre-existing page because you can't insert and modify a page in the same DQL. Lazy again.
Dummy := if(telle=0, concat(MemoMemoCopy(Body, any Templates with TemplateID ="TL0002" Body ,tMCopy),"") ,"") ; -- here we insert the first page, and append the
successive.
Dummy := MemoReplace(Body ,concat("[{CustomerName",tRow,tColumn,"}]"), Customers CustomerName ) ; -- here we dynamically replace the tags in the matrix
Dummy := MemoReplace(Body ,concat("[{Contact",tRow,tColumn,"}]"),Customers Contact ) ;
Dummy := MemoReplace(Body ,concat("[{Town",tRow,tColumn,"}]"),Customers Town ) ;
Dummy := MemoReplace(Body ,concat("[{PostCode",tRow,tColumn,"}]"),Customers PostCode ) ;
Dummy := MemoReplace(Body ,concat("[{Country",tRow,tColumn,"}]"),Customers Country ) .
tColumn := tColumn + 1 . -- counting up the columns
telle := telle + 1 . -- lazy again, it never need to be more than 1 to make the trigger mechanise safe.
end
retval := SetLabelText("Status",concat("Generate Labels finished. ",data-entry field1, " labels generated.")) .
retval := SetVar("TempFilter","Avery1")+DocumentOpen("Temporary") .
Se Also:
MemoMemoReplace()
StringReplace()
Function::Memo
MemoSetGlobal()
Usage:
MemoSetGlobal("MyVariableName",Memo) MemoSetGlobal("MyLog",LogMemo)
Purpose:
To copy the content of a local memo field into a global named variable where it can be retrieved later with MemoGetGlobal()
Memos can't be queried the normal way due the the size, so all manipulation and moving around have to be done via Memo Objects.
MemoSetGlobal() will set the content of a local Memo into a Global Memory variable (named) and MemoGetGloba() will retrieve it and insert it into a local Memo fields object.
Return value:
Nothing.
Content:
Examples:
Se Also:
Function::Memo
MemoStringBetween
Usage:
MemoStringBetween(TargetMemo,SearchMemo,"SearchOne",SearchTwo") MemoStringBetween(TargetMemo,MhHtml,"
"," content := MemoStringBetween(MyMemo,MySearchMemo,"[P001]","[/P001]")
Purpose:
Copies the text between SearchOne and SearchTwo to TargetMemo.
It will return the value non-incluse of the search values.
Return value:
Number: number of characters copied. -- WIll be changed to 255 characters of the result string.
Content:
Examples:
Se Also:
MemoStringBetween
MemoStringFrom
MemoStringTo
22 July 2014
22 July 2014
22 July 2014
Function::Memo
MemoStringFrom
Usage:
MemoStringFrom(TargetMemo,SearchMemo,"Search") MemoStringFrom(TargetMemo,HTMLMemo,"
") retval := MemoStringFrom(TargetMemo,AnyMemo,"Afterthis:") .
Purpose:
Will copy the remainder of a Memo from search into the Target memo but not inclusive of search.
Return value:
Number: Length of text copied into TargetMemo. --Will be changed to first 255 characters of result memo.
Content:
Examples:
Se Also:
MemoStringBetween
MemoStringFrom
MemoStringTo
22 July 2014
22 July 2014
22 July 2014
Function::Memo
MemoStringTo
Usage:
MemoStringTo(TargetMemo,SearchMemo,SearchString) MemoStringTo(TargetMemo,HTMLDoc"") .
Purpose:
Will copy the content of SearchMemo up to but not including SearchString into Targetmemo.
Return value:
Number: Number of characters copied. -- Will be changed to first 255 characters of Targetmemo.
Content:
Examples:
Se Also:
MemoStringBetween
MemoStringFrom
MemoStringTo
22 July 2014
22 July 2014
22 July 2014
Function::Memo
MemoWordCount
Usage:
MemoWordCount(Memo) MemoWordCount(MyMemoField) NumberOfWords := MemoWordCount("MyMemoField") .
Purpose:
Will return the number of words in a Memo field.
Return value:
Number of words: Integer
Content:
MemoWordCount
Returns the number of words in a memo.
number MemoWordCount(Memo)
Examples:
Se Also:
Function::Memo
MemoWriteToFile
Usage:
MemoWriteToFile(MemoToWrite,Filname,Mode) MemoWriteToFile(MyMemo,"C:\temp\memoexp.txt",1) retval := MemoWriteToFile(Letter,FileName,1) .
Purpose:
To write the content of a Memo to a text file. THe content will be written as is, so if the content is HTML you will create a HTML file (remember to use the right extension).
You can overwrite (mode:1), Append (Mode:0-Default) and delete a file with this function. It also include modes for appending with new line etc.
Return value:
Nothing.
Content:
This function is part of a pair, where the opposite is MemoReadFromFile.
It is implemented to allow users to export the content of a memo to a text file.
So why would we want to do that?
With the new Memo manipulation class, memos can be manipulated in any way one like, they are containers for export data, import data, documents, webpages etc etc.
Wouldn't it be neat if one could save or share the content of these fields with oneself or the rest of the world? It is not so easy to send a memo field to someone, but we can all
attach a field as a document.
One test users actually created a full website in a DataEase 8 application, and then export all the dynamically generated pages to a webserver with MemoWriteToFile once a
day...
The neat thing with MemoWriteToFile is that it is not limited to writing to a file, it can also append to a file, overwrite a file or simply delete a file.
int MemoWriteToFile(MemoToWrite,Filename,Mode)
Mode:
0=Append value to memo field.
1=Overwrite memo field with new value.
2=Delete/Blank Content of memo field.
3=Insert value at beginning of memo field.
4=Append value to Memo with CR in front (Start on new line)
5=Insert value at beginning of memo with CR after.
Examples:
Se Also:
Function::CDF
Message
Usage:
Purpose:
Return value:
Content:
REFERENCE FOR MSGBOX.DLL
DISCLAIMER:
This CDF is provided for illustration purposes only of the uses for a Custom Defined Function within DataEase for Windows. This
CDF is provided 'As is' with no warranty whatsoever, either expressed or implied. DataEase International, Inc. does not
warrant the CDF to be error free, nor does it warrant the CDF to meet your specific requirements. In addition, this CDF is not
approved for use, nor is it subject to Technical Support by DataEase International, Inc.
FUNCTION:
MESSAGE ( Message Text , Caption Text , Icon , Buttons , Beep )
PURPOSE:
Displays a custom Windows message box allowing the application developer to specify a custom message, message box title, a message
icon, various button combinations for dispatching the dialog and an audible beep. This function can be used alone or in conjunction with
other DataEase for Windows functions. The function returns an integer value corresponding to the Users response in dispatching the dialog.
PASSING ARGUMENTS:
1. Message Text: a text message the application developer wishes to display.
2. Caption Text: a 50 character string used as the title for the message dialog.
3. Icon: an integer value that specifies what type of icon to display in
the message box.
1 Information Icon ( i )
2 Exclamation Icon ( ! )
3 Stop ( Stop sign )
4 Question ( ? )
5 No icon
4. Buttons:
an integer value that specifies what combination of buttons to
be displayed in the message dialog for the user to use in
dispatching the dialog and sending return values back to the
function.
0 (default) OK
1 OK CANCEL
2 RETRY CANCEL
3 ABORT RETRY CANCEL
4 YES NO
5 YES NO CANCEL
5. Beep:
an integer values that specifies what type of audible beep to
generate according to a given system alert level. The sound for
each alert level is determined by an entry in the [sounds]
section of WIN.INI.
0 or 1 (default) no sound
2 System sound
3 Information sound
4 Exclamation sound
5 Stop sound
6 Question sound
7 OK sound
RETURN VALUES:
Each message dialog you display will include at least one push button
for the user to dispatch the dialog. When a button is pressed, the
Message function returns an integer value indicating that it received
a user response and DataEase will continue processing. The following
return values correspond to the available buttons for display:
1 ABORT
2 CANCEL
3 IGNORE
4 NO
5 OK
6 RETRY
7 YES
0 Out of Memory
TIP:
Since the function returns an integer value, it may be awkward when
using Message in field derivations. The following example
illustrates one way to use Message:
SCENARIO:
We have a form with a date field called DEPARTURE DATE, and we
want to display a message when the user enters a date that is
prior to today's date (e.g. it's difficult to leave when you
already have). However, if the user enters a date after Today's
date, we want to display a message that indicates on what day of
the week that date occurs.
Field: DEPARTURE DATE
Derivation Formula:
if ( DEPARTURE DATE < current date ,
if ( Message
( jointext ( "The date you entered: " ,
jointext ( DEPARTURE DATE , " is invalid. \n\t
Do you want today's date?" )
),
"Invalid Date Message" , 4, 4, 6 ) = 7 ,
if ( Message
( jointext ( "Your entry date will be replaced with
today's date: " , current date ) ,
"Enter Current Date", 1, 0, 3 ) = 5, current date ,
current date ) ,
if ( Message
left blank." ,
"Discard Entry Date" , 2, 6, 4 ) = 5 , blank, blank )
),
if ( Message
( jointext ( "The date you entered: " ,
jointext ( DEPARTURE DATE,
jointext ( " is a " ,
spellweekday ( weekday ( DEPARTURE DATE ) ) ) ) )
"Day of the Week", 4, 4, 6 ) = 5 ,
DEPARTURE DATE , DEPARTURE DATE ))
NOTE: the symbols /n/t on line 4 tell Windows to display a
<newline> and <tab>.
FUNCTION:
BEEP ( Beep )
PURPOSE:
Generates an audible sound from the PC's speaker.
PASSING ARGUMENTS:
1. Beep:
an integer values that specifies what type of audible beep to
generate according to a given system alert level. The sound for
each alert level is determined by an entry in the [sounds]
section of WIN.INI.
0 or 1 (default) no sound
2 System sound
3 Information sound
4 Exclamation sound
5 Stop sound
6 Question sound
7 OK sound
RETURN VALUE:
The return value means nothing and can be discarded or ignored.
INSTALLATION OF MSGBOX.DLL AS A DataEase for Windows CDF:
Open the application within which you wish to integrate the function.
From the Menu Bar, select APPLICATION - CUSTOM FUNCTIONS. Fill in the
form as shown below and press F2 for each function (both functions are
contained in the same DLL).
Function Name: MESSAGE
OS Type: WINDOWS
Description: DISPLAYS CUSTOM MESSAGE BOX
CDF Library Name: MSGBOX.DLL
Return Type: INT
DOS Mem Req't:
DOS Entry Point:
Parm 1 Name: TEXT MESSAGE
Parm 1 Type: STRING
Parm 2 Name: CAPTION TITLE
Parm 2 Type: STRING
Parm 3 Name: ICON DISPLAY
Parm 3 Type: INT
Parm 4 Name: BUTTON SELECTION
Parm 4 Type: INT
Parm 5 Name: BEEP SOUND
Parm 5 Type: INT
Parm 6 Name:
Parm 6 Type:
Parm 7 Name:
Parm 7 Type:
Parm 8 Name:
Parm 8 Type:
Parm 9 Name:
Parm 9 Type:
Parm 10 Name:
Parm 10 Type:
Function Name: BEEP
OS Type: WINDOWS
Description: MAKES AN AUDIBLE BEEP
CDF Library Name: MSGBOX.DLL
Return Type: INT
DOS Mem Req't:
DOS Entry Point:
Parm 1 Name: BEEP SELECTION
Parm 1 Type: INT
Parm 2 Name:
Parm 2 Type:
Parm 3 Name:
Parm 3 Type:
Parm 4 Name:
Parm 4 Type:
Parm 5 Name:
Parm 5 Type:
Parm 6 Name:
Parm 6 Type:
Parm 7 Name:
Parm 7 Type:
Parm 8 Name:
Parm 8 Type:
Parm 9 Name:
Parm 9 Type:
Parm 10 Name:
Parm 10 Type:
Examples:
Se Also:
Function::String
MidC
Usage:
Purpose:
Return value:
Content:
midc
Type
Text Function
Purpose
The midc function extracts a specified number of characters from the middle of a text value.
Syntax
midc( TEXT VALUE, m, n)
?where;
m is the starting position in the text value and
n is the number of characters to extract.
Returns
A text value n characters in length.
Usage
midc(FIELDNAME, m, n) returns n characters beginning at character position m (inclusive). Spaces and punctuation symbols are included.
Examples
midc( "DataEase" , 4, 3)
Returns: aEa
midc( "Club ParaDEASE" , 6, 3)
Returns: Par
midc( LAST NAME, 4, 2)
Returns: Two characters beginning at the fourth character position in the LAST NAME field for every record that is processed. If a record contains the value Birnbaum in the LAST NAME field,
the function returns nb.
Examples:
Se Also:
Function::String
MidW
Usage:
Purpose:
Return value:
Content:
midw
Type
Text Function
Purpose
The midw function extracts a specified number of words from the middle of a text value.
Syntax
midw( TEXT VALUE, m, n)
?where
m is the starting position in the text value and
n is the number of characters to extract.
Returns
A text value n words in length.
Usage
midw(FIELDNAME, m, n) returns n words beginning at word number position m (inclusive). Spaces and punctuation symbols are included.
Examples
midw( "Sapphire International Ltd." , 2, 1)
Returns: International
midw( "Club ParaDEASE Catalog" , 2, 2)
midw( STREET, 2, 3)
Returns: Three words beginning at the second word position in the STREET field for every record that is processed. If a record contains the value "540 Avenida de los Delfines" in the STREET
field, the function returns "Avenida de los".
Examples:
Se Also:
Function::DateTime
Minutes
Usage:
Purpose:
Return value:
Content:
minutes
Type
Time Function
Purpose
The minutes function extracts the minutes from a time value expressed in a 24-hour format.
Syntax
minutes( TIME VALUE)
Returns
An integer value from 00 to 59.
Examples
minutes( 12: 00: 00)
Returns: 00
minutes( 23: 59: 00)
Returns: 59
Examples:
Se Also:
Function::Mathematical
Mod (modulus)
Usage:
Purpose:
Return value:
Content:
mod (modulus)
Type
Scientific Function
Purpose
The mod (modulus) function returns the remainder when one numeric value is divided by a second numeric value. If both values are integers, an integer value is returned. Otherwise, a
decimal value is returned.
Syntax
mod( NUMERIC VALUE 1, NUMERIC VALUE 2)
Returns
A numeric value.
Usage
The numeric value in a Scientific function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
mod( 8, 3)
Returns: 2
mod( 12.6, 1.6)
Returns: 1.4
Examples:
Se Also:
Function::DateTime
Month
Usage:
Purpose:
Return value:
Content:
month
Type
Date Function
Purpose
The month function extracts the month (1- 12) from a date value.
Syntax
month( DATE VALUE)
Returns
An integer value between 1 and 12
The date format selected using the International option in the Windows Control Panel changes the date sequence but does not affect which value is returned by a Date function.
Examples
month( 12/31/99)
Returns: 12 ( North American format)
month( 31/12/99)
Returns: 12 (European format)
month( 99/12/31)
Returns: 12 (Metric format)
Examples:
Se Also:
Function::Internal
MoveObject
Usage:
MoveObject("ObjectName","Xpos","Ypos") MoveObject("Record1","C","C") MoveObject("MyBox","-10","+100") MoveObject(*MyField","200","200")
MoveObject("MyField","S200","S50)
Purpose:
Moving an object (and all its children) from its current position to any new position. The function contains functionality to allow the object to be moved to an absolute position, a
relative position or to be centred within the current window.
You can use this function to move a single object to a wanted position, or you can use it to move an entire Record Object, Tab Control or Subform to a centred or relative
position.
Return value:
String:Nothing
Content:
Examples:
Example 1:
Derivation in virtual field:
MoveObject("Record1","C","C")
Make sure that the record object for the current form has been resized to fit the objects on the form (Default size is same as form i.e .100x200cm) and change the background
colour of the form object to the same as the record object if you want it to look like the record object is just centred in the window.
This is the original form. See how the record object has been resized and is placed in the upper left corner.
This is the result. The record object has been centred in the window. Definitely more "user friendly".
The field that do it is the little white field next to the DE8 Logo. We call the field (and object) Manip. It is a virtual field with the derivation:
SetState("Manip",0)+MoveObject("Record1","C","C")
The SetState is so the field itself is invisible in Runtime.
Example 2:
Here we will show how you can use the S option as well as the + option to both reposition and resize objects to fit the current window. To get the current windows height and
width we use GetCurrent("Height") and GetCurrent("Width").
This is the form in Design Mode. You can see that it is a mess...
In Runtime it looks like this. You can see that it perfectly fits the current window.
Again we use a Manip field to execute the derivations.
)+SetState("Width",0)+SetState("Height",0)+SetState("Manip",0)
Se Also:
SetState()
SetFocus()
OML
ExecDQL()
GetCurrent()
Function::Action
Usage:
Purpose:
Opens the new document dialogue with Menu preselected.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
NewProcedure
Usage:
NewProcedure() retval := NewProcedure() .
Purpose:
Opens the new document dialogue with Procedure preselected.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
NewReport
Usage:
NewReport() retval := NewReport() .
Purpose:
Opens the new document dialogue with Report preselected.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
NextRecord
Usage:
NextRecord() retval := NextRecord().
Purpose:
Goes to the next record
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
OpenForm
Usage:
OpenForm() OpenForm("FormName") OpenForm(FieldWithFormName) OpenForm("MyForm") retval:=OpenForm("MyForm").
Purpose:
If FormName is not empty the specified document will be opened. If FormName is empty then a dialog will display with all documents.
DFW Action(s): Open Form -- Enter: Form Name
Return value:
Status : Integer
Content:
Examples:
Se Also:
Function::Action
Usage:
Purpose:
If MenuName is not empty the specified document will be opened. If MenuName is empty then a dialog will display with all documents.
Return value:
Status : Integer
Content:
Examples:
Se Also:
Function::Action
OpenProcedure
Usage:
OpenProcedure() OpenProcedure("ProcedureName") OpenProcedure(FieldWithProcedureName) OpenProcedure("MyReport") retval:=OpenProcedure("MyProcedure").
Purpose:
If ProcedureName is not empty the specified document will be opened. If ProcedureName is empty then a dialog will display with all documents.
DFW Action(s): Open Procedure-- Enter: Procedure Name
Return value:
Status : Integer
Content:
Examples:
Se Also:
Function::Action
OpenReport
Usage:
OpenReport() OpenReport("ReportName") OpenReport(FieldWithReportName) OpenReport("MyReport") retval:=OpenReport("MyReport").
Purpose:
If ReportName is not empty the specified document will be opened. If ReportName is empty then a dialog will display with all documents.
Return value:
Status : Integer
Content:
Examples:
Se Also:
Function::Action
Paste
Usage:
Paste () retval := Paste () .
Purpose:
Pastes data from the clipboard
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Mathematical
Percent
Usage:
Purpose:
Return value:
Content:
percent
Type
Conditional Statistical Operator
Purpose
The percent operator calculates the percentage of records that satisfy a condition specified by a comparison of two values.
Syntax
CONDITION : percent [other conditional statistical operators]
Returns
A numeric value.
Example
for MEMBERS ;
list records
LAST NAME in order ;
TOTAL DUE ;
TOTAL DUE > 100 : item percent .
end
This query tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) list each member's TOTAL DUE, (3) for each member, display a YES
or NO answer indicating if the TOTAL DUE is over \$100, and (4)display the percentage of records that have a TOTAL DUE value greater than \$100 in the report output.
The output from this query might look as follows:
Last Name
Albert
Anders
Andersen
Anderson
Archer
Baldwin
Beauchamp...
Total Due
\$85.00
\$120.00
\$120.00
\$70.00
\$115.00
\$155.00
\$100.00
\$35.00...
Total Due greater than \$100 = 22%
Examples:
Se Also:
Total Due greater than \$100
NO
YES
YES
NO
YES
YES
NO
NO...
Function::Mathematical
Periods
Usage:
Purpose:
Return value:
Content:
periods
Type
Financial Function
Purpose
The periods function calculates how long a financial transaction requires to reach a future target value given the presentvalue, futurevalue, installment payment, and interest rate.
Syntax
periods( presentvalue, futurevalue, installment, rate)
Returns
A numeric value (the number of periods needed to reach the target futurevalue of the investment).
Usage
If the installment payment increases the value of the investment (e.g., an annuity), the installment is expressed as a positive amount. If the payment decreases the value of the investment (e.g.,
loan amortization), the installment is expressed as a negative amount.
The interest rate, installment payments, and time periods must be based on the same terms. To determine periods as a number of months, the rate is expressed as the annual rate / 12. To
determine periods as a number of weeks, the rate is expressed as 7*annual rate / 365.
Examples
ceil( periods( 10000, 0, -150, 8 / 12) )
Returns: 89
This example calculates how many months it takes to repay a loan of \$10,000 at 8% annual interest with monthly installment payments of \$150. The ceil function rounds up the result to the next
integer.
ceil( periods( 0, 10000, 250, 10 / 12) )
Returns: 35
This example calculates how many months it takes to accumulate \$10,000 in savings, if you begin with no money in the account, make monthly deposits of \$250, and earn 10% annual interest.
Note: DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ((1 + (rate/100)) ** periods) + (installment/(rate/100)) * (((1 + (rate/100)) ** periods) - 1)
When typing fractions like 8 / 12, DataEase requires that you type a space before and after the / division symbol.
Examples:
Se Also:
Function::Mathematical
Power
Usage:
Purpose:
Return value:
Content:
power
Type
Scientific Function
Purpose
The power function raises a numeric value to a specified power.
Syntax
power( BASE, EXPONENT)
Returns
A numeric value equal to the base raised to the exponent.
Usage
DataEase does not support ** as a symbol for exponentiation. Use the power function instead.
Examples
power( 12, 2)
Returns: 144
power( 6, 3)
Returns: 216
power( 8, 1 / 3)
Returns: 2
Examples:
Se Also:
Function::Mathematical
Presentvalue
Usage:
Purpose:
Return value:
Content:
presentvalue
Type
Financial Function
Purpose
The presentvalue function calculates the required starting amount for a financial transaction given the futurevalue, installment payment, interest rate, and number of payment periods.
Syntax
presentvalue( futurevalue, installment, rate, periods)
Returns
A numeric value (the initial value before any installment payments are made).
Usage
If the installment payment increases the value of the investment (e.g., an annuity), the installment is expressed as a positive amount. If the payment decreases the value of the investment (e.g.,
loan amortization), the installment is expressed as a negative amount.
The interest rate, installment payments, and time periods must be based on the same terms. For example, if the periods are expressed in months, the monthly interest rate is expressed as the
annual rate/12.
Example 1
presentvalue( 0, -150, 7.9 / 12, 48)
Returns: 6156.12
This example calculates the auto loan amount you can afford to borrow at an interest rate of 7.9% if you want to repay the loan in 48 monthly payments of \$150.
Example 2
presentvalue( 125000, 150, 10 / 12, 240)
Returns: 1514.00
This example calculates the required starting balance for a savings plan designed to accrue a \$125,000 balance in 20 years based on monthly payments of \$150 and an annual interest rate of
10%.
Note: DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ( ( 1 + ( rate/100) ) * * periods) + ( installment/( rate/100) ) * ( ( ( 1 + ( rate/100) ) * * periods) - 1)
When typing fractions like 7.9 / 12, DataEase requires that you type a space before and after the / division symbol.
Examples:
Se Also:
Function::Action
PrintDocument
Usage:
PrintDocument() retval := PrintDocument() .
Purpose:
To print the current document.Will print according to Documents Print Options.
Will open Print Dialogue if Print Without Dialogue is not selected in Print Options.
Combine with Application printers to achieve dynamic printing.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Applciation Printers
Function::Action
PrinterSetup
Usage:
PrinterSetup () . retval := PrinterSetup () .
Purpose:
Displays printer setup dialog
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::File
PrintHTML
Usage:
PrintHtml(HTMLFileToPrint,Printer,Mode) PrintHtml("C:\temp\mytestfile.html","",1) -- print to default printer, print preview. retval := PrintHtml(MyHtmlFile,"",3) . -- print to default
printer with dialog.
Purpose:
To print the content of a text file as HTML via the built in HTML object. Will print the file as formatted HTML, but can be used to print normal text files as well. They will then be
printed with the standard formatting of the HTML object.
Currently will only print to default printer (which can be changed via CDF) but will be changed to print to named printer.
Return value:
Nothing
Content:
So why do we add a function like this. Is it DataEase job to print a text/html document?
Yes, it is now!
In DataEase 8 you can generate a Text/HTML document in several ways. For redundancy and flexibility we "replicate" functionality in two difference scenarios. In one scenario
we use the Memo field as the direct storage class, but you can also use files directly. Using one or the other is down to you, but sometimes it is better to use a file (memo is
limited to 32k anyway), and sometimes it is better to use Memo.
You can now for instance use a DQL and MemoWriteToFile with the append option to dynamically create an output file/export file.
If it is an export file, fine. But if you for instance built a HTML invoice, letter etc, you might want to print it directly. And this is what PrintHTML() does.
It is not secret that formatting printing in DFW is a nightmare, and we haven't spent our time trying to fix this. It should have been done 20 years ago, but the reason they never
did is that the way printing was implemented in DFW was a mistake, and a big one.
It might have been possible to correct this back then, and it might have made a big difference, but now it is simply to late. Instead of doing brain surgery on this difficult code,
we try to go around it by offering alternative routes.
With the new MemoClass functionality, you can create any document dynamically and print it as HTML. This means that you can format it anyway you like, and a WYSIWYG
finally means something. You will also be able to print "size to fit" etc, and dynamic formatting...high time!
Over the next year we will also publish a spin off from our DG3 development DataEase 8 Reporter. This is a standalone tool where you can make Reports/DQL's etc proper
DataEase Style against your DataEase 8 data.
You can also dynamically include the reports/prints in your DataEase 8 through the WebField interface.
Sound to good to be true? He,he....wait and see!
Examples:
Se Also:
Function::Memo
PrintMemo
Usage:
PrintMemo(MemoToPring,Printer,Mode) PrintMemo(MyMemo,"",1) -- print to default printer, print preview. retval := PrintMemo(MyMemo,"",3) . -- print to default printer with dialog.
Purpose:
Print the Content of a Memo as formatted HTML. Typical use is when you have used HTMLEditor to create a document stored in a Memo, you use this function to automatically
print the content. You can use it anywhere including DQL etc.
Return value:
Nothing
Content:
DataEase for Windows printing is concat("CR","AP).
How could a product that was the master of exporting, listing, printing go so completely astray?
As interesting as the answer to that question might be, the answer to the next would be even more interesting..
How come they never fixed it?
Anyhow, this is what we now do. In line with our new strategy of not changing functionality, but adding alternatives, we have now added a way of Printing the content of a Memo
directly.
So why would I want to do that?
DataEase Forms are quite good as forms, but they are useless as reports. The format used in DFW is an absolute format, and the printing of this is something called
wallpapering. i.e. it is printed WYSIWYG exactly as it is represented on the screen. If it is 0.000001 mm larger than your page, it adds a page to the right etc.
Which crazy person thought this was how the world was going to work in the 21st Century should stop reading Science Fiction comic books, and return to the planet earth.
(The fact that 10mm on a DataEase report is not 10mm on a printer, just add to the exhilaration...read frustration).
They have obviously not be able to fix this or realise the problem over the last 20 years, and we must just assume that it is a good reason for it, and what would happen to all
the reports that has been massaged to fit into this crazy framework over the years, if we actually fixed it?
So our conclusion must be, leave it alone and focus on making alternative ways of solving it.
All of this will be history in DG3, but there is a life before DG3 too, and that is our main priority here.
We now use Memo to build documents (HTML or simply text), which you can so print via our WebField object. This way you get a properly formatted document every time, on all
printers.
Are we dreaming?
Examples:
PrintMemo( Body ,"",3)
PrintMemo( Body ,"",0)
Se Also:
Function::Action
PrintPreview
Usage:
PrintPreview() . retval := PrintPreviw() .
Purpose:
Same as PrintDocument() but will print the document in a zoomed out mode (Screen)
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::String
Proper
Usage:
Purpose:
Return value:
Content:
proper
Type
Text Function
Purpose
The proper function converts the first letter in each word in a text value to uppercase.
Syntax
proper( TEXT VALUE)
Returns
The specified text value with the first letter in each word capitalized.
Usage
Any letter preceded by a space, hyphen, ampersand, or a period is capitalized by the proper function as is the first letter in a parenthesized value. Other punctuation, including the apostrophe,
does not act as a delimiter for the proper function.
If you enter a capital letter in a position that is not the first letter in the word or specified value, it remains in uppercase when the value is processed by the proper function.
To capitalize the first character of each word and force all other characters to lower-case, use the lower function in conjunction with the proper function as follows:
proper ( lower ( LAST NAME) )
The proper function is commonly entered as the Derivation Formula for Text fields during Form Definition. For example, if the derivation for the LAST NAME field is:
proper(LAST NAME)
DataEase follows the rules listed above to capitalize the values entered in the LAST NAME field.
Examples
proper( "playa blanca" )
Returns: Playa Blanca
proper( "sapphire international" )
Returns: Sapphire International
proper( FULL NAME)
Returns: The value in the FULL NAME field in the proper format for each record processed. For example, if a record contains the value roger birnbaum, the function returns Roger Birnbaum.
Examples:
Se Also:
Function::Action
QBM_NewReport
Usage:
QBM_NewReport() retval := QBM_NewReport() .
Purpose:
Open the QBM dialogue with the MultiView from the current document pre-selected.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Mathematical
Random
Usage:
Purpose:
Return value:
Content:
random
Type
Math Function
Purpose
The random function returns a random decimal value between 0 and 1 (inclusive). No value is required in the function's argument.
Syntax
random( )
Returns
A number between 0 and 1 (inclusive).
The result of the random function is really a pseudo-random number calculated by a formula, not a true random number.
Usage
The following steps are used to generate a random integer using the random function:
Determine the range (number of possibilities) in which the random number must fall. For example, if the desired range is between 10 and 100, the range is 90.
Determine starting value (smallest integer) of the range. In the example 10-100, the starting value is 10.
Use the following formula to generate a random integer:
( random( ) * RANGE) + STARTING VALUE
Examples
floor( random( ) * 9)
Returns: A random integer between 0 and 9.
floor( random( ) * 90) + 10) )
Returns: A random integer between 10 and 100.
In these examples, floor rounds down the result to the nearest integer.
Examples:
Se Also:
Function::Mathematical
Rate
Usage:
Purpose:
Return value:
Content:
rate
Type
Financial Function
Purpose
The rate function calculates the interest rate of a financial transaction given the presentvalue, futurevalue, installment payment, and the number of payment periods.
Syntax
rate( presentvalue, futurevalue, installment, periods)
Returns
A numeric value (the interest rate).
Usage
If the installment payment increases the value of the investment (e.g., an annuity), the installment is expressed as a positive amount. If the payment decreases the value of the investment (e.g.,
loan amortization), the installment is expressed as a negative amount.
The interest rate, installment payments, and time periods must be based on the same terms. If payments are made monthly, periods is computed as the number of years * (multiplied by) 12 and
rate is computed as 1/12 of the annual rate.
Example 1
12 * rate( 12000, 0, -289, 48)
Returns: 7.3
This example calculates the annual interest rate on a \$12,000 car loan to be repaid in 48 monthly payments of \$289.
Example 2
12 * rate( 0, 20000, 250, 60)
Returns: 10.2
This example calculates the annual interest rate required to accumulate \$20,000 in savings, if you begin with no money in the account and make monthly payments of \$250 over a period of
5years.
Note: DataEase financial functions are derived from the formula shown below. (The double asterisks (meaning "raise to the power") cannot be used in a script).
futurevalue = principal * ((1 + (rate/100)) ** periods) + (installment/(rate/100)) * (((1+ (rate/100)) ** periods) - 1)
When typing fractions like 10 / 12, DataEase requires that you type a space before and after the / division symbol.
Examples:
Se Also:
Function::Action
RecordDelete
Usage:
RecordDelete() retval := RecordDelete().
Purpose:
Deletes current record. Will show Delete record dialogue.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
RecordFirst
Usage:
RecordFirst() retval := RecordFirst().
Purpose:
Goes to the first record.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
RecordLast
Usage:
RecordLast() retval := RecordLast().
Purpose:
Goes to the last record
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
RecordPrevious
Usage:
RecordPrevious() retval := RecordPrevious().
Purpose:
Goes to the previous record
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
RecordRestore
Usage:
RecordDelete() retval := RecordDelete().
Purpose:
Rstores deleted record. This will only work immediately after delete and for current record. If you browse away from the record you will not be able to restore.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
RecordSave
Usage:
RecordSave() retval := RecordSave().
Purpose:
Save the current record. If record already exist it will update the record.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
RecordSaveNew
Usage:
RecordSaveew() retval := RecordSaveNew().
Purpose:
Save the current record. If record already exist a copy of the record with changes will be saved.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Internal
RefreshForm
Usage:
RefreshForm()
Purpose:
All new DataEase 8 functions and functionality look after their own screen update and refresh. But sadly, not all historic "new" functionality do the same.
The combination of Tab Control and Subforms and simply advanced Tab Controls have a tendency not to Refresh correctly.
RefreshForm() will simply refresh the current Document according to the "virtual" data record that is valid.
It will no re-read data from the database, simply update the GUI controls with the current values they should display.
It will not change any data.
Return value:
None
Content:
This is obviously an unnecessary function but we have created it anyway...;-)
DataEase 7.x or aka. the "Flasher from Romford", was flashing and blinking like mad. Every time you moved from one field to the next, it looked like it was going to have a fit. In
7.2 we reduced this a lot, but not without side effects it seems.
The reason for all this flickering and flashing, was that DFW refreshed the screen everything something changed, and there was a good reason for this. Bad programming!
They had included a lot of new functionality over a very short time, and they hadn't really had time to do proper QA as a lot of you have since found out... All of these functions
should "look after themselves" as one should in proper Object oriented programming, but it seems a lot of them slept in class, so the quick fix was simply to refresh them all
all the time.
We switched that off in 7.2 and made them behave as they should most of the time, but they are many and they are everywhere, the code is big, old and difficult...Need we say
more.
In 8 we have cleaned up a lot more, but our focus is no longer on making DataEase for Windows the neatest student in the class, but the one with the best tools, so instead of
spending our time finding all the places and times it doesn't refresh properly, we leave it to by giving you a tool to do it for us.
You are the one that have the problem, and need a fix NOW. If you report it to us, we prioritise, put it into our development schedule you re looking at forever before you have a
fix (most likely because we decide that it is not worth fixing anyway...;-)) Anyways, our focus now is on giving you the tools to fix any problem when you encounter it rather than
coming crying back to mum.
FormRefresh() will simply insure that when you call it, the screen will look like you expected, that all objects that should display are displayed with the correct values derived or
in-putted.
PS! Don't confuse this with the old function RefreshScreen(). (They should actually have swapped names). RefreshScreen() refresh the current form with the latest saved data
from the database. This is useful if you have created a Horse Racing result app or something, and want to display the latest results.
FormRefresh() refresh the Screen but does not hit on the database, it simply refresh with the derived and inputed data in the temporary record (unsaved record). This is very
useful if you have manipulated values with OML or other functions.
It will also sort out problem with Subforms not displaying correctly in Tabs etc...nobody have ever had this problem of course, but if one have, it will fix it...
Examples:
Example
Here we get the opportunity to show it off with another new function - SetValue().
SetValue sets a value in any field, but it might experience GUI update problems. Especially if the field in question is currently having the Focus etc. So to make sure that Our
new values are displayed immediately we simply call RefreshForm() as part of the button click.
Se Also:
RefreshScreen
Function::Internal
RefreshScreen
Usage:
RefresScreen() retval := RefreshScreen() .
Purpose:
When RefreshForm() refresh the form without re-reading the data from the saved record, RefreshScreen() do the opposite i.e. replace the content of the visible form with the
latest saved Data in the table.
This is used to display changes that is done by another process/user or done via ExecDQL directly on the PRISM columns/tables.
Return value:
None
Content:
This is obviously an unnecessary function but we have created it anyway...;-)
DataEase 7.x or aka. the "Flasher from Romford", was flashing and blinking like mad. Every time you moved from one field to the next, it looked like it was going to have a fit. In
7.2 we reduced this a lot, but not without side effects it seems.
The reason for all this flickering and flashing, was that DFW refreshed the screen everything something changed, and there was a good reason for this. Bad programming!
They had included a lot of new functionality over a very short time, and they hadn't really had time to do proper QA as a lot of you have since found out... All of these functions
should "look after themselves" as one should in proper Object oriented programming, but it seems a lot of them slept in class, so the quick fix was simply to refresh them all
all the time.
We switched that off in 7.2 and made them behave as they should most of the time, but they are many and they are everywhere, the code is big, old and difficult...Need we say
more.
In 8 we have cleaned up a lot more, but our focus is no longer on making DataEase for Windows the neatest student in the class, but the one with the best tools, so instead of
spending our time finding all the places and times it doesn't refresh properly, we leave it to by giving you a tool to do it for us.
You are the one that have the problem, and need a fix NOW. If you report it to us, we prioritise, put it into our development schedule you re looking at forever before you have a
fix (most likely because we decide that it is not worth fixing anyway...;-)) Anyways, our focus now is on giving you the tools to fix any problem when you encounter it rather than
coming crying back to mum.
FormRefresh() will simply insure that when you call it, the screen will look like you expected, that all objects that should display are displayed with the correct values derived or
in-putted.
PS! Don't confuse this with the old function RefreshScreen(). (They should actually have swapped names). RefreshScreen() refresh the current form with the latest saved data
from the database. This is useful if you have created a Horse Racing result app or something, and want to display the latest results.
FormRefresh() refresh the Screen but does not hit on the database, it simply refresh with the derived and inputed data in the temporary record (unsaved record). This is very
useful if you have manipulated values with OML or other functions.
It will also sort out problem with Subforms not displaying correctly in Tabs etc...nobody have ever had this problem of course, but if one have, it will fix it...
Examples:
Se Also:
Function::Internal
RefreshStatus
Usage:
RefreshStatus() retval:=RefreshStatus()
Purpose:
Function that will automatically refresh all status/info/system documents in DE8. You can now run this function and after you will be sure that all these info tables are up to
date.
This is very useful if you use the Status Tables for programming or information purposes. We use the as basis for manipulation of data throughout the table, as well as input in
UserMode based Editors etc.
Return value:
Nothing
Content:
Examples:
Se Also:
Function::Action
ReturnToParentDoc
Usage:
ReturnToParentDoc() retval := ReturnToParentDoc()
Purpose:
Closes the current document and returns focus to the parent document.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::DateTime
Seconds
Usage:
Purpose:
Return value:
Content:
seconds
Type
Time Function
Purpose
The seconds function extracts the seconds from a time value expressed in 24-hour format.
Syntax
seconds( TIME VALUE ) paren
Returns
An integer value from 0 to 59.
Examples
seconds( 09: 15: 34)
Returns: 34
seconds( 02: 53: 20)
Returns: 20
seconds( CHECK-OUT T IME)
Returns the seconds value in the CHECK-OUT TIME field for every record that is processed. If a record contains the value 07:30:25, the function returns 25.
Examples:
Se Also:
Function::Action
SelectionFilter
Usage:
SelectionFilter("QueryPart1","QueryPart2") SelectionFilter("CustomerNr=","0001") . SelectionFilter("CustomerName=",concat("/'",cutomername,"/'"))
SelectionFilter("CustomerName between 0001 to 0010","")
Purpose:
To set the selection filter for the maintable in a form from a script or button.
Selectionfilter is "Under-used" but very useful when one figure it out (which almost nobody have). It is deceptive in the fact it takes two arguments but that might be due to a
wrong design that has been brought forward because the filter is simply a formatted string like you would use in DQL.
You can put the entire filter in the first argument and leave the second one blank, but peculiarly not the other way around.
You can use all operators in the filter like +>< between etc and you can even use functions like
CustomerNr=GetVar("CustomerNr") if you wanted.
As it will need a fully formatted string which would include "" if you compare a text field you will need to use the new StringEscape() functionality i.e. use /' for " in the string whcih
will be converted to ".
You don't have to use StringEscape() function as it is built into SelectionFilter() and most other functions in DE8.
Return value:
NOthing.
Content:
Examples:
Se Also:
StringEscape()
Function::Internal
Send
Usage:
Send(String) Send(Blat -to [optional switches (see below)]) Send(Blat -SaveSettings -f -server [-port ] [-try ] [-profile ] [-u ] [-pwd ] ) o
Purpose:
Sending emails from anywhere inside a DataEase application. You can use it from a button, derivation, DQL or OML.
Return value:
Content:
Examples:
You need to configure the SMTP server before you can use the function:
Ex.
Send(blat -installSMTP smtp.mymail.com [email protected] 1 587 - [email protected] secretpw)
When the server is configured you can send a test message like the one below:
Send(blat -to [email protected] -subject "I am testing Email from DataEase 8" -body "This seems to work brilliantly!Thanks! [email protected]")
All transferable parameters in DataEase are limited to 255 characters, and this is in most cases to short for sending meaningful messages so you need to send the body as a
file attachment for larger mails. For this we use the new Memo and File functions.
You can for instance edit the Email body in HTMLedit and then save it to a file with MemoWriteToFile().
and then you include the body file and attachments in the configuration string.
ex.
Send(Sendstring) where the sendstring looks like this:
blat -to [email protected] -html -subject "This is a testmail" -bodyf "C:\Users\Ulrik\Documents\My DataEase\DE8DATA\SimpleMailTest\mail\00001.html" -af
"C:\Users\Ulrik\Documents\My DataEase\DE8DATA\SimpleMailTest\mail\00001.att"
As you can see here you need to format with " which is not straight forward in traditional DataEase. In DE8 we have included CHR() as a function and quote is CHR(34).
Formula in sendstring looks like this:
concat("blat -to ",To ," -html -subject ", chr(34) ,Subject,chr(34) ," -bodyf ",chr(34),mailfile,chr(34), if (MemoLength(Attachments) >0,concat(" -af ",chr(34),AttachmentFile,chr(34)
),""))
You will find examples doing this in both the CRM app included with DE8 and if you create a new application from the Default Template.
In the CRM app we also have a landing page which is the first page loaded after login to the app. This landing page configure the email server for the active user before
progressing to loading the Addressbook. You can do something similar to insure that the email server is configured before you start sending emails.
Se Also:
Function::Internal
SendEmail
Usage:
Synopsis: sendemail -f ADDRESS [options] Required: -f ADDRESS from (sender) email address * At least one recipient required via -t, -cc, or -bcc * Message body required
via -m, STDIN, or -o message-file=FILE
Purpose:
We have had a Email functionality included in DE8 since DE8.0 but it had one big limitation and that was that it couldn't use SMTP with TLS which in reality is most modern
SMTP services.
Services like GMAIL etc will demand that you use TLS and so will most public SMTP services. We are therefore happy to include SenEmail (command line tool) in our
distribution to improve the direct emailing functionality in DE8.
Return value:
Content:
Examples:
Se Also:
Send
12 September 2014
Function::Internal
SetColor
Usage:
SetColor("objectname#number(optional)","font","fill","border") SetColor("MyField","-1","#00ff00","-1") SetColor(concat("MyField#",MyRecordNr),"#ff0000","-1","#ff0000")
Purpose:
To change the color of an object during runtime. You can change font, fill and border color.
Return value:
Nothing
Content:
Sets the border, fill and font color of a Field or a button.
SetColor("ObjectName","Font","Fill","Border")
Returns empty string.
Parameters are strings. Important to use Object name with no Spaces behind and case sensitive.
"Font","Fill","Border" are transfered as hex values or Dec. Hex values preceded with #
Ex.
SetColor("Field 1","#ff0000","#00ff00","#0000ff")
Examples:
Se Also:
Function::Internal
SetFocus
Usage:
SetFocus("ObjectName") SetFocus(FieldWithObjectName) retval := SetFocus("CustomerName") .
Purpose:
To move the cursor/focus to an object. This function will move the focus to any object that can take input/action. You can use this to control the tab order of your app depending
on values inputted in fields etc.
This has been a focus long wished for as it will give you complete control on the input order of your form. Combine with SetState(Show/Hide/Enable/Disable and Clicked) to
give the best user experience possible.
Return value:
Nothing
Content:
When the SetValue() function is implemented in a couple of days, the Keystroke CDF lovers will get competition.
To be able to direct the next action/input from the result of a previous have been a wished for functionality in DataEase "for ever", but for some reason the resolution has not
been quick in arriving...
For those of you that have delved into the obscure and dangerous way of OML know there is a Method called "Select". Promising.... But first you discover that nothing happen,
and when you check the documentation:
Select
Not implemented in 6.0. When implemented, Select will select an object - essentially gives focus to that object.
Turns out that it was never implemented later either.... We even checked if our "Big Brother" had fixed it in their DataEase aka Ffenics ;-), with the same result both in the
program and the help file, and they won't fix it for a while because it says "Not implemented in 6.0" there too, and they have only gotten to 1.6...
Ok, enough fun. As you might be aware of now, OML is not the way forward for DataEase, so we try to implement the most "useful" features as functions in DataEase 8, so it
will be more "accessible" to the wider community. OML is implemented with the same flair, risk aversion and shoddy attitude that gave us the DFW DQL. It was a great idea,
but as many other "great" ideas in DFW, it was not followed up by great work, and eventually left like a couple of dirty socks on the bathroom floor.
If you don't already use it, forget about it, which lead me back onto the matter at hand (I love this Blog formt...:-). SetFocus(), I am sorry but there is not much to say, that hasn't
already been said in the Subject Line.
Function that set the cursor/focus on any field/button that you want, it will return....NOTHING!
Why? All the new Manipulation functions return nothing, this way you can use them as part of any formula/derrivation.
concat("One","Two",SetFocus("Field 22") or in a numerical field... Field1+SetFocus("Field 22").
Fun?
Examples:
Se Also:
Function::Internal
SetLabelText
Usage:
SetLabelText("ObjectName","NewText") SetLabelText("MyLabel","This is a test!") SetLabelText("CustomerLabel","Please Enter correct customer Name!") retval
:=SetLabelText("MyButton","Click!") .
Purpose:
To change the text property on a Label, Button, Tab. This can be used for error message, further information, to store information in the page/form for future query, to change
the label on a button or tab etc.
Return value:
Nothing
Content:
SetLabelText() is a function that will allow you to change a label from anywhere in DataEase 8. You can use it from ExecDQL, in a field derivation or from a button.
Like all new Set functions it works on the Form context so you will use the object denomination "objectname".
SetLabelText("MyLabel","This is a sample")
SetLabelText("MyLabel",Field1)
SetLabelText("MyLabel",concat(GetGlobal("LabelVar"),";",MyField))
NB! All object names are case-sensitive!
Label as a "virtual" field.
You can use Labels as Messages and you can combine them with SetState() for hiding and showing, SetColor() to change the color and background color etc.
One of the obvious benefits over normal fields is that they are not fields. Fields are part of the data-schema and if you change a field it will affect the status of the form as being
"changed", this does not happen when you use a label.
Another great benefit is that they are transparent, so you can put them on top of Images etc.
NB! Remember that the size of a label cannot be changed from this function so make sure that your label object is large enough to accommodate your message. A label will
typically be the right size for it's original content so you will have to drag it out to the max size of the content you want to fit. Labels are automatically multiline.
Examples:
Se Also:
Function::Memo
SetMemoValue
Usage:
Purpose:
To Insert the content of a PRISM Memo into the EditControl of a MemoField in a form.
If you are running an ExecDQL that manipulate a memo and you then want to insert this memo into the active form (the form that called the Memo) you cannot use Modify
Records in the DQL directly as this will render the Current record invalid doe to data being changed in another session, so you need to use the FORM control to populate the
column.
SetMemoValue() is the bridge between a PRISM column (any) and the active Memo Edit Control on the form.
Return value:
Nothing.
Content:
This is the complementary function to SetValue() for normal fields and again the complementary function for the PRISM function MemoMemoCopy().
This function allow you to set the visible part of a Memo Edit control by copying the content of a PRISM memo field to the GUI Object.
Format: SetMemoValue("MyMemo",PrismMemo)
This can be useful in many contexts but one particular spring to mind...from inside ExecDQL.
You can manipulate a MemoField in the DQL and when finished you simply push it back into a visual control in the Form.
Example:
define temp "retval" text .
for MemoTest ;
retval := SetMemoValue("DestMemo",FromMemo) .
This sample is a stupid sample that copy a memo from one record and push it into the on screen records "DestMemo" object.
Examples:
Se Also:
Function::Internal
SetState
Usage:
SetState("ObjectName",State) SetState("MyButton",0) -- Hide SetState(ObjectNameField,StateField) retval := SetState("MyButtn",4) -- Click Event called. Same as button being
clicked by mouse
Purpose:
SetState is a function that will make it possible to manipulate objects from a derivation/DQL without having to use OML properties. SetState will hide/show, enable and disable.
Latest addition is ClickObject which will remotely call the click event on a button or any other object. Very useful for controlling execution.
Return value:
Nothing.
Content:
SetState() will manipulate ScreenObjects like fields, buttons etc (in practice everything).
format SetState("Object",State) returns empty string so it can be included in any function without interfering with result of formula.
SetState("Field",0) will hide.
SetState("Field",1) will show.
SetState("Field",2) will disable
SetStage("Field",3) will enable.
Examples:
Se Also:
SetFocus(), SetValue(), SetStyle(), GetStyle(), GetValue(), SetLabelText()
Function::Internal
SetStyle
Usage:
SetStyle(ObjectName,Style) SetStyle("MyObject","MyStyle") SetStyle("Button 1","Normal") SetStyle("Record1",ToggleField) retval:=SetStyle("Button 1","RedStyle") .
Purpose:
In DataEase 8 manipulation is one of the new key elements. Pre 8, you had to use OML to manipulate or change DT properties in RT. In DataEase 8 we have introduced a
number of new functions to give the developer the opportunity to change the appearance of the form based on runtime actions. SetColor() and SetState() being to key functions.
SetColor() has the "drawback" that it basically change the colour of an object (Limited to Font,Fill,Border if applicable).
SetColor() is a great addition but as "web style" approach is what we are going for in DE8, it would be nice if one could change the style on objects the same way one can in
HTML/CSS. This way the developer can simply change a style instead of finding the code where he changed the colour. You will also be able to change all the properties of an
object in one small action.
When using SetColor() for for-instance mouse-over on a button, you will need to know the colours to change back to on mouse out etc, but with SetStyle you can simply have
ButtonNormal and ButtonOver and toggle them with SetStyle().
Return value:
Nothing
Content:
Examples:
Example 1 - OML
MyButton::MouseEnter
define "reval" text .
retval := SetStyle("MyButton","MouseOver") .
MyButton::MouseExit
define "reval" text .
retval := SetStyle("MyButton","Normal") .
When defining the style you simply define Normal as the look you want when the function is not Selected, and MouseOver the way you want it to look when the mouse is
hovering over. No reason why you should do the same for Clicked etc.
Se Also:
SetColor()
SetState()
SetFocus()
Function::Internal
SetValue
Usage:
SetValue("MyField","NewValue") SetValue("CustomerName",CustomerName) Retval := SetValue("RecordID",highest of Customers RecordID) .
Purpose:
This is a bridge between PRISM and GUI where you can set the value contained in a GUI column into a FORM EditControl.
This function can be used to populate the GUI Editcontrol of any FORM EditField including Memo but will only transfer up to 255 characters.
This is the function to use if you want to return values to the active form from an ExecDQL as you cannot populate directly with Modify Records as this will corrupt the active
record (you will get a "Record has changes since read!" error message.
You can also use this to push values inside the form as traditional DataEase functions are PULL (derived), SetFunctions including SetValue() are push so you can force
consequence. Ex.: If you derive virtual fields based on COLUMNA you can push a value into COLUMNA and the virtual fields will be triggered.
Return value:
Content:
Set a value in a different field from a derrivation, action or script.
This function push a value into another field. combine with SetFocus and SetColor for impact and flow.
Returns empty string so it can be called from any derrivation without interfering with result.
Examples:
Se Also:
SetMemoValue()
SetState("ObjectName",4) -- click object for remotely push button etc.
Function::Internal
SetVar
Usage:
SetVar(String,String) SetVar("MyVariableName","MyValue") SetVar("MyVar",MyField) retval := SetVar("VarName",Result) .
Purpose:
Set any named global variable anywhere to be used anywhere in an app within the same session.
There has been several CDF libraries that has tried to tackle this need over the more than 30 years DataEase have been around, but for some strange reason DataEase itself
has never seen the need for implementing this very useful and necessary feature - before now.
The CDF libraries that has offered this service have all had the weakness that they have numbered the variables and also have a limited supply of them. For instance
SetArray() has only 10 and SetGlobal() only 100.
SetVar is "unlimited" and you can name them.
One avid and long-standing user has pointed out that it was quite useful to use numbers for the variables as you could then loop through and name them automatically, but
you can of course still use number or a combination of text and numbers as DataEase automatically convert between formats. See Examples below.
Return value:
Nothing. This is the standard for most new functions so they can be added in chains without impacting the result.
Content:
As part of the DataEase for Windows restoration project we have come to a big omission in DataEase - Global Variables or transfer of information between processes if you
like.
It amazes us how many wishes, needs and wants from almost every user, that has been blatantly ignored by "us". We have had no qualms in brushing off desperate user with
a CDF or a receipt long as your arm to "fix" a problem in our product.
In DataEase 8 we have deemed to remedy a lot of these omissions. It might be too late for a lot of users, but that excuse is getting to old too. When we took over development
we were told that yes LegEasy DOS is how it should have been done back in 1994 but alas, now it was too late.
Bull...it. We can't hide behind "too late". It is only too late if we think that DataEase will ever be used by people that have already used it, but our goal is to get it to be used by
people that have never used it too.
Just because there is some CDF's that can transfer a limited number of variables, and there is an SQL return code that one can use for the same, doesn't mean that the
problem is solved. Especially not when we are going to tell you all to not use DQL body for printing.
What? Not using DQL body for printing, not using DQL for printing? No! It doesn't work, and it never have. It is the achilles heel of DataEase for Windows and a couple of hours
working with it is enough to kill the spirit of the bravest.
DQL without Printing is both effective and amazing, but the way the body has been implemented is just backwards.
I can guarantee you that nobody that make a living from using DataEase use the DQL body for anything. So if you are a new user, don't even try.
The fact that the Data-Entry form is as limited doesn't make the situation any better.
Use DQL for processing, and use Report for printing! End of story!
The only reason we use DQL for printing is that that is what we used to do in DFD, and the reason we used to do that in DFD is because we need to have a data-entry form.
In DataEase 8, we have introduced Virtual Editable Field so you can make a DataEntry form as a normal for with relationships etc. Then you use the new
SetGlobal("Variablename",Value) to set the global variables either in a virtual field or directly on the button that Fire the Report. In the report you set the Filter and use
GetGloal("Variablename") and the job is done.
With Set/GetVar() you can have as many global variables as you like and you can give them descriptive names.
You can of course use them for anything you like, the above is just an example.
SetVar("MyVariable",Field1)
Examples:
Example 1
SetVar("MyStyle",GetStyle("MyButton") -- This will read the stylename of button my button and put it in the Global variable MyStyle.
You can now reset the button to original style by using:
SetStyle("MyButton",GetVar("MyStyle"))
Example 2
Define "counter" number .
Define "Retval" text .
For MyForm ;
Retval := SetVar(concat("MyVar",Counter),CustomerName) .
List records
CustomerName .
This example will generate a numbered variable for each customerName, but it would maybe be better to use for instance CustomerNr as the name for the variable.
Define "counter" number .
Define "Retval" text .
For MyForm ;
Retval := SetVar(CustomerNr,CustomerName) .
List records
CustomerName in order ;
CustomerNr .
You will now be able to retrieve the value of the Global variable by referncing with the CustomerNr.
Se Also:
Function::Mathematical
Sin
Usage:
Purpose:
Return value:
Content:
sin
Type
Trigonometric Function
Purpose
The sin function calculates the sine of an angle expressed in radians.
Syntax
sin( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
sin( 2.53)
Returns: 0.574172
sin( -3)
Returns: -0.14112
Examples:
Se Also:
Function::Mathematical
SinH
Usage:
Purpose:
Return value:
Content:
sinh
Type
Trigonometric Function
Purpose
The sinh function calculates the hyperbolic sine of an angle expressed in radians.
Syntax
sinh( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
sinh( 2.53)
Returns: 6.2369235
sinh( -4.4)
Returns: -40.71929
Examples:
Se Also:
Function::String
SpellCurrency
Usage:
Purpose:
Return value:
Content:
spellcurrency
Type
Spell Function
Purpose
The spellcurrency function spells the monetary equivalent of a numeric value.
Syntax
spellcurrency( NUMERIC VALUE)
Returns
A text value.
Examples
spellcurrency( 36.25)
Returns: Thirty Six Dollars and 25 Cents
spellcurrency( 210.00)
Returns: Two Hundred Ten Dollars and 00 Cents
spellcurrency( TOTAL DUE)
Returns:The spelled-out currency amount in the TOTAL DUE field for every record processed. If a record contains the value 905.75, the function returns Nine Hundred and Five Dollars and 75
Cents.
Note: the actual currency used is determined by which regional version of DataEase you have purchased. UK users, for example, should see the words ?pounds? and ?pence? instead of ?
dollars? and ?cents?.
Examples:
Se Also:
Function::String
SpellDate
Usage:
Purpose:
Return value:
Content:
spelldate
Type
Spell Function
Purpose
The spelldate function spells a date value in common form.
Syntax
spelldate( DATE VALUE)
Returns
A text value.
Examples
spelldate( 07/01/01)
Returns: July 1, 2001
spelldate( 12/31/00)
Returns: December 31, 2000
spelldate( highest of RESERVATIONS DATE )
Returns:The spelled-out value in the most recent reservation's DATE field. If the most recent RESERVATIONS record contains the value 10/31/01 in the DATE field, the function returns October
31, 2001.
Examples:
Se Also:
Function::String
SpellMonth
Usage:
Purpose:
Return value:
Content:
spellmonth
Type
Spell Function
Purpose
The spellmonth function spells the name of the month that corresponds to a numeric value from 1 (January) to 12 (December).
Syntax
spellmonth( NUMERIC VALUE)
Returns
A text value.
Usage
The input value must be an integer between 1 and 12 (inclusive).
Examples
spellmonth( 7)
Returns: July
spellmonth( month( 12/31/99)
Returns: December
spellmonth( month( highest of RESERVATIONS DATE ) )
Returns: The name of the month that corresponds to the value in the most recent reservation's DATE field. If the most recent RESERVATIONS record contains the value 10/31/01 in the DATE field,
the function returns October.
Examples:
Se Also:
Function::String
SpellNumber
Usage:
Purpose:
Return value:
Content:
spellnumber
Type
Spell Function
Purpose
The spellnumber function spells the integer portion of a numeric value.
Syntax
spellnumber( NUMERIC VALUE)
Returns
A text value
Usage
spellnumber(999999999) returns Nine Hundred Ninety Nine Million, Nine Hundred Ninety Nine Thousand, Nine Hundred Ninety Nine.
Examples
spellnumber( 3.45)
Returns: Three
spellnumber( 323.45)
Returns: Three Hundred Twenty Three
spellnumber ( RESERVATION ID )
Returns: The spelled-out number in the RESERVATIONID field for every record that is processed. If a record contains the value 10251, in the RESERVATION ID field, the function returns Ten
Thousand Two Hundred Fifty One.
Examples:
Se Also:
Function::String
SpellWeekday
Usage:
Purpose:
Return value:
Content:
spellweekday
Type
Spell Function
Purpose
The spellweekday function spells the name of the day that corresponds to a numeric value from 1 (Monday) to 7 (Sunday).
Syntax
spellweekday( NUMERIC VALUE)
Returns
A text value.
Examples
spellweekday( 5)
Returns: Friday
spellweekday( weekday( 12/31/99)
Returns: Sunday
spellweekday( weekday( highest of RESERVATIONS DATE ) )
Returns: The name of the day that corresponds to the value in the most recent reservation's DATE field. If the most recent RESERVATIONS record contains the value 10/31/99 in the DATE field,
the function returns Tuesday.
Examples:
Se Also:
Function::Mathematical
Std.Dev. (standard deviation)
Usage:
Purpose:
Return value:
Content:
std.dev. (standard deviation)
Type
Statistical Operator
Purpose
The std.dev. operator calculates the standard deviation (the square root of the variance) in a set of data. The result usually appears as a statistic in the summary area at the end of a report.
Syntax
FIELDNAME|VARIABLE : std.dev. [other statistical operators] ; | .
Returns
A numeric value.
Usage
Standard deviation is used as an indicator of variability in a set of data (68% of the data set is contained in the first standard deviation).
The std.dev. operator can also be used when creating a report using Query by Model. To generate the standard deviation in Query by Model, highlight the column whose standard deviation you
want to calculate, then select std.dev. in the Summarize pick list.
Example
for MEMBERS with TOTAL DUE > 175 ;
list records
LAST NAME in order ;
TOTAL DUE : item sum std.dev. .
end
This script tells DataEase: (1) Process all the MEMBERS records that have a value greater than \$175 in the TOTAL DUE field, (2) list the members by LAST NAME in alphabetical order, and (3) list
each member's TOTAL DUE amount, the sum of these amounts, and the standard deviation in the report output.
The output from this script might look as follows:
Last Name
Christino
Perrault
Stafford
Strachan
Sum Total Due:
Std. Dev. in data set:
Examples:
Se Also:
Total Due
\$280.00
\$215.00
\$185.00
\$205.00
\$885.00
\$41.10
Function::String
StringBetween
Usage:
StringBetween("MyString","FromString","ToString") StringBetween("My HTML
This is a test
","
","
") - returning This is a test retval := StringBetween(MyTextField,"[{Name}]","[{/Name}]")
Purpose:
Will search through a string and return the text between two search strings not inclusive i.e
Return value:
Text (255): The string between the search values, or the remainder of the text if Endtag is not found.
Content:
Examples:
Se Also:
StringTo()
StringFrom()
MemoStringBetween()
MemoStringTo()
MemoStringFrom()
Function::String
StringEscape
Usage:
StringEscape(String) StringEscape("/'This will appear in quotes/'./CR/TBThis will be show on new line and one tab in")
Purpose:
To allow users to include reference to certain "forbidden" characters in a DE string and return the parsed result.
Characters include is:
" = /'
CR = /CR (New line)
TAB=/TB (Tab)
Tags are case sensitive, so /cr would not be escaped
Return value:
String with parsed letters.
Content:
There is an historical problem with including certain characters in DataEase strings, especially in derivations etc. " in particular has been difficult and prior to Version 8.0 there
was no good way of building strings or passing strings containing this character in DE. In DE8.0 we got CHR() which made it possible to build strings including " by using
CHR(34) and concatenate a string. However this is rather awkward, and particularly when using functions that demand a lot of " etc.
StringEscape() was devised so the developer can parse the entire string in one go without the need of concatenation etc.
However bear in mind that StringEscape() is the fallback function, this functionality has now been included in ALL string functions, so you will now be able to use the switches
directly in functions like ExecDQL(), Concat(), SelectionFilter() etc.
Examples:
Exanple 1:
Code: StringEscape("/'This will appear in quotes/'./CR/TBThis will be show on new line and one tab in")
Return:
"This will appear in quotes"
This will show on new line and one tab in.
Se Also:
Chr()
ExecDQL()
ConCat()
SelectionFilter()
MemoCopy()
WriteToFile()
Function::String
StringFind
Usage:
StringFind("StringToSearch","TextToSearchFor") StringFind("This is a test","test") . retval := StringFind(FieldToSearch,Search) .
Purpose:
Search a string to find if the substring is find in it. If it is find it will return the position of the first substring.
The position usage has been superseeded by the StringTo(),StringBetween(),StringFrom() function so will be changed to returning the number of substrings in string.
Return value:
Integer: Postion of Substring in string. 0 if no match. Will be changed to the count of substring in string.
Content:
Returns start position of StringToFind i.e larger than 0 if a string is part of a text. Returns 0 if it isn't.
int StringFind(StringToSearch,StringTofind)
It is a complimentary function to *string* which is a simply boolean function.
With StringFind you find the start of a string you look for, so you can use it to cut out a second or third string from an existing string.
you can search for the beginning of a string(you know the length of the string you search for, so the value you are really looking for starts at
StringFind(StringToSearch,StringTofind)+Length(StringToFind)
if you want to return the value between to occurrences, you simply do.
MidC(StringToSearch,StringFind(StringToSearch,StringTofind)+Length(StringToFind),StringFind(StringToSearch,StringTofind2)
DataEase is fun, ne ces't pas?
Examples:
Se Also:
StringBetween()
StringTo()
StringFrom()
MemoStringBetween()
MemoStringTo()
MemoStringFrom()
Function::String
StringFrom
Usage:
StringFrom(String,StringToSearchfor) StringFrom("My Test this is a Test string","Test") -- will return string as it search for the last occurrence. retval :=
StringFrom(MyTextField,SearchFor) .
Purpose:
To return the remainder of a string after the search. Very useful for trimming file names from paths etc.
It search from the tail of the string i.e. right to left so will return everything after the last occurrence in the string seen from the left (normal direction).
Return value:
String(255): Everything after StringToSearchFor but not inclusive. If no match return blank.
Content:
Examples:
Example1:
This will return "Invoice.pdf" as it search right to left and will return everything after the last \ in the string.
Se Also:
StringBetween()
StringFrom()
MemoStringBetween()
MemoStringTo()
MemoStringFrom()
Function::String
StringReplace
Usage:
StringReplace(StringToReplaceIn,StringToReplace,StringToReplaceWith) StringReplace("This is a test","a test","brilliant!") -- result: This is brilliant.
StringToReplace(MyTextField, ToReplace,ReplaceWith) retval := StringToReplace(MyTextField, ToReplace,R
Purpose:
To replace all occurrence of a text in a string with another text.
Can be used to replace names, codes, spelling mistakes etc in a text field.
Return value:
String(255): The complete string with the changes.
Content:
A useful little function.
If you did a mistake, have changed name, address etc, why not simply find and replace.
Simple find and replace...
text StringRepace(StringToReplaceIn,StringToReplace,StringToReplaceWith)
What more to say, if you don't see the use, you never will..;-)
Examples:
Se Also:
MemoReplace()
MemoMemoReplace()
Function::String
StringTo
Usage:
StringTo(StringToSearch, StringToSearchFor) StringTo("My String is a test string. Test is all I do","Test") -- Will return: My String is a. retval := StringTo(MyTextField,Search) .
Purpose:
To search s a string up to but not including of the search string and return that substring.
Return value:
String(255): String up to but not including the search value.
Content:
Examples:
Se Also:
StringBetween()
StringFrom()
MemoStringBetween()
MemoStringTo()
MemoStringFrom()
Function::Internal
Sum Of
Usage:
sum of RELATIONSHIP column sum of TABLENAME column Syntax: sum of TABLENAME|RELATIONSHIP [ named "UNIQUE RELATIONSHIP NAME" ] [ with {selection criteria}
] FIELDNAME
Purpose:
The sum of operator sum the FIELDNAME across all records in a related table match the specified selection criteria. The result can appear as a list item in the detail area of a
report or as a statistic in the summary area at the end of a report.
There's an important difference between the conditional statistical operator sum and the relational statistical operator sum of. sum sums up the FIELDNAME of records that
satisfy a specified condition among the records being processed. sum of sums the FIELDNAME queried of matching records related to the records being processed by the
script.
Return value:
Numeric Value The sum of FIELDNAME that fit the relational restriction. If no Relational restriction the sum of FIELDNAME in the entire table.
Content:
sum of
Type
Relational Statistical Operator
Purpose
The sum of operator adds the values in a specified field in all matching records in a related table. The result can appear as a list item in the detail area of a report or as a statistic in the summary
area at the end of each group or at the end of the report.
Syntax
sum of TABLENAME|RELATIONSHIP
[named "UNIQUE RELATIONSHIP NAME" ]
[with ( selection criteria) ] FIELDNAME ; | .
Returns
A numeric value.
Example
for MEMBERS ;
list records
LAST NAME in order ;
sum of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) for each MEMBERS record processed, find all the related records in
the RESERVATIONS table (those that have the same MEMBERID), and (3) list the sum of the TOTAL DUE field for the set of RESERVATIONS records that match the current MEMBERS record.
The output from this script might look as follows:
Last Name
Albert
Anders
Andersen
Anderson
Archer...
Sum of Reservations
Total Due
\$3000.00
\$4760.00
\$4420.00
\$2100.00
\$4320.00
\$4796.00...
If you want to include the sum of this whole group of reservations, change the fourth line of the query to read:
sum of RESERVATIONS TOTAL DUE : item sum .
Note: There's an important difference between the statistical operator sum and the relational statistical operator sum of. sum returns the total of the values in the specified field among the records
being processed. sum of returns the total of the values in the specified field among the records related to the records being processed.
Examples:
Example 1
In a field derivation.Simplest type. We have two tables. ThisTable and MyCustomers. We have no relationships defined.
sum of MyCustomers TotalInvoiced
This will return the sum of what I have invoiced all my customers.
Example 2
We have two tables.CustomerType and MyCustomers. We have a relationship between them that connect CustomerType and MyCustomers on customer type.There is no
Unique Alternative Name for the Relationship. I have 300 records in MyCustomer and 45 of type Good Credit. As they all buy a fixed service product that cost \$10 i will have
invoiced them \$450.
My active record in CustomerType is the Good Credit record.
sum of MyCustomers TotalInvoiced
This will return the number \$450 as I am now using the relationship instead of the table.
sum of MyCustomers named "AllRecords"
This will return the number \$3000 as I have now defined a unique relationship with no restriction and I will get the total invoiced across the table..
Example 3
sum of MyCustomers named "NewRel" with RegistrationDate=current date TotalInvoiced
This will return the total invoiced today
Example 4
for MEMBERS ;
list records
LAST NAME in order ;
sum of RESERVATIONS TOTAL DUE .
end
This script tells DataEase: (1) Process all the MEMBERS records and list each member's LAST NAME in alphabetical order, (2) for each MEMBERS record processed, find all
the related records in the RESERVATIONS table (those that have the same MEMBERID), and (3) list the sum of the TOTAL DUE field for the set of RESERVATIONS records that
match the current MEMBERS record.
The output from this script might look as follows:
Last Name
Sum of Reservations
Total Due
\$3000.00
Albert
\$4760.00
Anders
\$4420.00
Andersen
\$2100.00
Anderson
\$4320.00
Archer...
\$4796.00...
If you want to include the sum of this whole group of reservations, change the fourth line of the query to read:
sum of RESERVATIONS TOTAL DUE : item sum .
Note: There's an important difference between the statistical operator sum and the relational statistical operator sum of. sum returns the total of the values in the specified field
among the records being processed. sum of returns the total of the values in the specified field among the records related to the records being processed.
Se Also:
Count Of Highest Of Lowest Of Mean Of
Function::Mathematical
Tan (tangent)
Usage:
Purpose:
Return value:
Content:
tan (tangent)
Type
Trigonometric Function
Purpose
The tan function calculates the tangent of an angle expressed in radians.
Syntax
tan( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
tan( 2.53)
Returns: -0.701292
tan( -1.89)
Returns: -3.025665
Examples:
Se Also:
Function::Mathematical
TanH (hyperbolic tangent)
Usage:
Purpose:
Return value:
Content:
tanh (hyperbolic tangent)
Type
Trigonometric Function
Purpose
The tanh function calculates the hyperbolic tangent of an angle expressed in radians.
Syntax
tan( NUMERIC VALUE)
Returns
A numeric value.
Usage
The numeric value in a Trigonometric function can be a constant value (as shown below), a variable, a field value, or an expression.
Examples
tanh( 2.53)
Returns: 0.987388
tanh( 1.45)
Returns: -0.895692
Examples:
Se Also:
Function::String
TextPos
Usage:
Purpose:
Return value:
Content:
textpos
Type
Text Function
Purpose
The textpos function returns the first position of a substring in a specified text value.
Syntax
textpos( "TEXT VALUE" | FIELDNAME, "SUBSTRING" )
Returns
An integer value that indicates the position where the substring begins in the specified text value.
Usage
The textpos function is not case sensitive (no distinction is made between upper and lower case letters).
If the substring is contained in the specified text value, the starting position of the first (leftmost) character in the substring is returned.
If the substring is not contained in the text value, the function returns 0. Intervening spaces and punctuation symbols are included in the calculation. Trailing spaces are ignored.
Examples
textpos( "Buccaneer's Creek" , "can" )
Returns: 4
textpos( "Sapphire International" , "national" )
Returns: 15
textpos( CLUB NAME, "bus" ) ,
Returns: The first position of the string bus in every record that is processed. If a record contains the value Columbus Island in the CLUB NAME field, the function returns 6.
Note: textpos interprets wildcard symbols like ?*? as a character, rather than a wildcard. It can therefore be used to detect the presence of such wildcard characters in a text string
Examples:
Se Also:
Function::DateTime
TimeAmPm
Usage:
Purpose:
Return value:
Content:
timeampm
Type
Time Function
Purpose
The timeampm function converts a time value from a 24-hour format to a 12-hour format and appends the appropriate AM or PM designation.
Syntax
timeampm( TIME VALUE)
Returns
A text value representing the 12-hour clock time with a suffix of either AM or PM. Converts time values from midnight (00:00:00) to (11:59:59) to AM. Converts time values from noon (12:00:00) to
(23:59:59) to PM.
Examples
timeampm( 13: 53: 12)
Returns: 01: 53: 12 PM
timeampm( 11: 10: 30)
Returns: 11: 10: 30 AM
timeampm( DEPARTURE TIME)
Returns the value in the DEPARTURE TIME field in the 12-hour clock format and adds the correct suffix for every record that is processed. If a record contains the value 19:30:25 in the
DEPARTURE TIME field, the function returns 07:30:25 PM.
Examples:
Se Also:
Function::String
ToText
Usage:
ToText(Value) ToText(Date) ToText(Number) Retval:=ToText(MyDateField) .
Purpose:
To make sure a non-text field is returned as text in a script/derivation.
Return value:
Text(255): Value input converted to string.
Content:
A lot of our seasoned developers know that what you see is not always what you get.
Internally DataEase converts values freely between formats, but not always. Especially when you use functions and allocated fields directly you might get peculiar results. Add
CDF to the mix and you WILL get peculiar results.
Anyone that has dipped deep into stuff like Oracle has met the peculiar Null vs 0 problem. It is highly scientific, but then a lot of these databases was originally designed for
scientific use. Haven't you wonder why half the functions in DataEase (up to 8) was Trigonometric functions like tan, atan and even atan2, or what about cos and
cosh(hyperbolic cosine). If bet that if you know what cosine is you have no clue what an hyperbolic cosine is...
It is kind of a paradox that a product like DataEase that didn't have CHR() until 8, would have something like that, but that is down to hits historic roots. I am pretty sure that you
today could easily launch a major application framework without cosh or even cos and easily get away with it, but not back in 1981.
Anyway, the NVL vs 0 problem is that in Oracle the number 0 and the definition NULL is not the same. 0 is a number in the middle between -1 and 1, when NULL defines
Nothing.
You are now thinking...what the heck is he talking about. When I have 0 in my account I have nothing, but that is wrong. When you have 0 in your account you are in fact quite
rich in comparison to someone that owns the bank 10.000 or even own them 1.
OK, OK!. You get my point. In practical terms, this is bullshit. But the problem in Oracle is that a number column when not initiated is actually NULL i.e. empty space and not 0.
Hence in Oracle you always have to check a number column with NVL(column) which is simply a function that turns NULL into 0.
See this is why Blogs are such a brilliant forum for the blogger, but maybe not so much for the Bloggee..YOU...he,he. I have now been able to ramble on about something that I
find interesting and hilarious, and that doesn't interest you at all, so I will get to the point.
ToText() is simply a function that insures that you transfer a string to another function. Most things in DataEase is transferred as strings so if you do that if you get weird results
you will be fine.
The seasoned dogs will already know this and use jointext(field,"") which will work fine...in fact that is all ToText() do... but isn't it more elegant if you have to do it a lot to have a
function do it for you?
It is 2012 after all...
Format: ToText(Field) returns Text
Examples:
Se Also:
Function::Action
UndoEdit
Usage:
UndoEdit () retval := UndoEdit() .
Purpose:
Undo the last action
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Internal
UniqueID
Usage:
UniqueID() retval := UniqueID() .
Purpose:
It has been a tradition in DataEase to use Sequence From to create a unique Record Identifier. This is not a good idea as Sequence From will not be allocated to the record
until the record is saved, and it can also cause problems if the sequencer loose track of itself.
UniquedID is created to insure that a developer can uniquely name and identify a record.
Return value:
String(16): Non Sequence Unique ID. Good spread to increase search speed with index.
Content:
One of the most popular and frustrating functions or should we rather say functionalities in DataEase is "Sequence from".
Basically this is a "guaranteed" sequence number, and it is great when you need records to be in sequence and have a unique number. Problem is that if to people register
data in the same table at the same time, the Sequence number you get when you start typing into your record, might not be the one the record ending up having when it is
saved.
The Sequence number you get when you start registering is the highest available at that time, and the same goes when you hit save, but in the meantime someone else might
have saved a record and the next available is hence one higher, or many numbers higher. The uniqueness and the sequence is preserved, but if you have use the Sequence
number to derive, link etc..you are in the sh....t.
The truth is that in most cases where we use Sequence From, we are simply looking for a unique key and not a sequence, so wouldn't it be better if we had a true Unique Key
generator?
In PRISM 9 (The next prism version after this) all records will have an automatic unique ID, but for now we must do it manually.
Enters: UniqueID() which returns a 16 character long guaranteed unique Key.
The result will look like this: B40EHNT8Q92445WX or 953V8Z0IOV9NB5JZ etc.
Make sure your Unique field is 16 characters long and text, or you might find that it is not unique after all ;-)
Examples:
Se Also:
Function::String
Upper
Usage:
Purpose:
Return value:
Content:
upper
Type
Text Function
Purpose
The upper function converts each letter in a text value to uppercase.
Syntax
upper( TEXT VALUE)
Returns
The specified text value with all the letters in uppercase.
The upper function only affects the alphabetical letters a-z. Numeric values are not converted to their Shift key equivalents.
Examples
upper( "DataEase" )
Returns: DATAEASE
upper( "Cancun" )
Returns: CANCUN
upper( LAST NAME)
Returns the value in the LAST NAME field in uppercase type for every record processed. If a record contains the value Birnbaum in the LAST NAME field, the function returns BIRNBAUM.
Examples:
Se Also:
Function::Action
ViewAsForm
Usage:
ViewAsForm() retval := ViewAsForm().
Purpose:
Set document to be displayed in single record format.There is two different default modes in DFW. Form and Table view.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Action
ViewAsTable
Usage:
ViewAsTable() retval := ViewAsTable().
Purpose:
Display multiple records in a tabular format..There is two different default modes in DFW. Form and Table view.
Return value:
Status: Integer
Content:
Examples:
Se Also:
Function::Internal
Wait
Usage:
wait(seconds) wait(1) wiat(DelayField) retval:=wait(1) RecordSave()+wait(0.1)+DocumentOpen("MyForm")
Purpose:
To delay before executing the next function/command/action. It is a problem in DFW that functions get posted to the command bus and then executed in "random" order. wait
will force them to be executed in the correct order.
Return value:
Nothing
Content:
Examples:
Se Also:
Function::DateTime
WeekDay
Usage:
Purpose:
Return value:
Content:
weekday
Type
Date Function
Purpose
The weekday function converts a date value to an integer that corresponds to the day of the week from 1 (Monday) to 7 (Sunday).
Syntax
weekday( DATE VALUE)
Returns
An integer value from 1 to 7.
Examples
weekday( 12/31/99)
Returns: 5
spellweekday ( weekday( 12/31/99) )
Returns: Friday
weekday( DATE)
Converts the value in the DATE field into an integer from 1 to 7 for every record processed. If a record contains the value 10/31/00 (a Sunday), the function returns 7.
Examples:
Se Also:
Function::File
WriteToFile
Usage:
WriteToFile(StringToWrite,FileToWriteTo,Mode) WriteToFile("This is a test","C:\temp\testfile.txt",1) -- will create/overwrite testfile.txt. retval :=
WriteToFile(MyTextField,MyFileName,MyMode) .
Purpose:
To create, overwrite or append to any type of text file (including HTML) with the content of a field or string(255). You can use this function to write the content of any DataEase
field except Memo to a text file.
in DFD we had Output etc, to create "advanced" export files, but in DFW export has been challenging. With WriteToFile() and MemoWriteToFIle() we have a solution that can
make and modify any Text file on the fly.
Return value:
Nothing
Content:
It is implemented to allow users to write a string to a text file.
So why would we want to do that?
With the new Memo manipulation class, memos can be manipulated in any way one like, they are containers for export data, import data, documents, webpages etc etc.
Wouldn't it be neat if one could save or share the content of these fields with oneself or the rest of the world? It is not so easy to send a memo field to someone, but we can all
attach a field as a document.
One test users actually created a full website in a DataEase 8 application, and then export all the dynamically generated pages to a webserver with MemoWriteToFile once a
day...
The neat thing with MemoWriteToFile is that it is not limited to writing to a file, it can also append to a file, overwrite a file or simply delete a file.
int MemoWriteToFile(MemoToWrite,Filename,Mode)
Mode:
0=Append value to memo field.
1=Overwrite memo field with new value.
2=Delete/Blank Content of memo field.
3=Insert value at beginning of memo field.
4=Append value to Memo with CR in front (Start on new line)
5=Insert value at beginning of memo with CR after.
Examples:
Se Also:
Function::DateTime
Year
Usage:
Purpose:
Return value:
Content:
year
Type
Date Function
Purpose
The year function extracts the year from a date value.
Syntax
year( DATE VALUE)
Returns
An integer value from 0 to 99 (inclusive). The date format selected in Windows Control Panel changes the date sequence but does not affect which value is returned by a Date function.
If the year function is used on an extended date field or variable, it will return a four digit numeric string from 1776 to 9999.
Examples
year( 12/31/99)
Returns: 99 ( most North American formats)
year( 31/12/99)
Returns: 99 ( most European formats)
year(99/12/31)
Returns: 99 (parentheses Metric format)parentheses
year( DATEFIELD)
Converts the year portion of the value in the DATE field into an integer from 0 to 99 for every record processed. If a record contains the value 12/31/99 in the DATE field, the function returns 99.
Examples:
Se Also:
Function::DateTime
YearDay
Usage:
Purpose:
Return value:
Content:
yearday
Type
Date Function
Purpose
The yearday function converts a date value to the Julian day of the year (1-366).
Syntax
yearday( DATE VALUE)
Returns
An integer value from 1 to 366 (inclusive). The date format selected in Windows Control Panel changes the date sequence but does not affect which value is returned by a Date function.
Examples
yearday( 12/31/99)
Returns: 365 ( most North American formats)
yearday( 31/12/99)
Returns: 365 ( most European formats)
yearday( 95/12/31)
Returns: 365 (parentheses Metric format)parentheses
yearday( DATE)
Converts the day portion of the value in the DATE field into an integer from 1 to 366, representing the Julian date, for every record processed. If a record contains the value 12/31/00 (a Leap
Year) in the DATE field, the function returns 366.
Examples:
Se Also:
Function::DateTime
YearWeek
Usage:
Purpose:
Return value:
Content:
yearweek
Type
Date Function
Purpose
The yearweek function calculates the week number (1-53) of a date value.
Syntax
yearweek( DATE VALUE)
Returns
An integer value from 1 to 53 (inclusive). The date format selected in Windows Control Panel changes the date sequence but does not affect which value is returned by a Date function.
Usage
This yearweek function always counts January 1st-7th as Week1, January 8th-14th as Week 2, etc. In a non-Leap Year, the only day in Week 53 is December 31st. In a Leap Year, December
30th is also counted in Week 53 (all dates following February 28 are affected by leap year).
Examples
yearweek( 01/01/99)
Returns: 1
yearweek( 12/30/99)
Returns: 52 ( most North American formats)
yearweek( 30/12/99)
Returns: 52 ( most European formats)
yearweek( 99/12/30)
Returns: 52 (parentheses Metric format)parentheses
yearweek( DATE)
Converts the day portion of the value in the DATE field into an integer from 1 to 53, representing the week of the year, for every record processed. If a record contains the value 12/30/96 (a
Leap Year) in the DATE field, the function returns 53.
Examples:
Se Also:
```