-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEmptyColumnsToNull.fmfn
79 lines (70 loc) · 2 KB
/
EmptyColumnsToNull.fmfn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* =====================================================
* @function EmptyColumnsToNull ( sqlResults; columnDelimiter; rowDelimiter; nullCharacter )
*
* @parameter sqlResults (string)
* @parameter columnDelimiter (string)
* @parameter rowDelimiter (string)
* @parameter nullCharacter (string)
*
* @return string Return the SQL results with empty values changed to null
*
* @category list
* @copyright 2015, Jason P. Scharf
*
* @version 1.0
*
* @dependencies NONE
*
* @purpose Prepare sql results for list manipulation functions.
*
* @notes
* @/notes
*
* @changes
* 2015-12-16, JPS, Created. [1.0.0]
* @/changes
* =====================================================
*/
Let (
[
/************************/
/* Start Configuration **/
/************************/
/* CONSTANTS ************/
Debug = False;
// Default to ASCII code 31 ( 31, 037, 1F - US, Unit Separator )
COL = If ( IsEmpty ( columnDelimiter ); Char ( 31 ); columnDelimiter );
// Default to ASCII code 30 ( 30, 036, 1E - RS, Record Separator )
ROW = If ( IsEmpty ( rowDelimiter ); Char ( 30 ); rowDelimiter );
// Default to ASCII code 21 ( 21, 025, 15 - NAK, Negative Acknowledgement )
NUL = If ( IsEmpty ( nullCharacter ); Char ( 21 ); nullCharacter )
/************************/
/* End Configuration ****/
/************************/
];
If (
IsEmpty ( sqlResults );
"";
/* ELSE */
Substitute (
sqlResults & ROW;
[
COL & COL;
COL & NUL & COL
];
[
COL & COL;
COL & NUL & COL
];
[
COL & ROW;
COL & NUL & ROW
];
[
ROW & COL;
ROW & NUL & COL
]
)
)
)