-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTableID.fmfn
66 lines (57 loc) · 1.77 KB
/
TableID.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
/*
* =====================================================
* @function TableID ( TableName )
*
* @parameter TableName (string)
*
* @return number The ID for the table.
*
* @category design
* @copyright 2014, Jason P. Scharf
*
* @version 0.0.1
*
* @dependencies NONE
*
* @purpose Get the internal table ID of the provided table name or fully
* qualified field name (FQFN).
*
* @todo NONE
*
* @changes
* 2014-07-10, JPS, Created (0.0.1).
* @/changes
* =====================================================
*/
Let (
[
/************************/
/* Start Configuration **/
/************************/
/*
* Test to see if the provided TableName is a FieldName string or a
* fields contents.
*/
~tableNameFieldContentsTest = GetFieldName ( TableName );
~tableName =
Case (
/* TableName is a Fully Qualified Field Name (FQFN). */
~tableNameFieldContentsTest = "?" and
PatternCount ( TableName ; "::" ) = 1;
GetValue ( Substitute ( TableName; "::"; ¶ ); 1 );
/* TableName is a fields contents. */
~tableNameFieldContentsTest <> "?";
GetValue ( Substitute ( ~tableNameFieldContentsTest; "::"; ¶ ); 1 );
/* TableName is is a FQFN or the fields contents. */
TableName
);
/* CONSTANTS ************/
VERSION = "0.0.1";
/************************/
/* End Configuration ****/
/************************/
/* Get the Table Name's ID */
~tableID = ExecuteSQL ( "SELECT TableID FROM FileMaker_Tables WHERE TableName = ?"; ""; ""; ~tableName )
];
~tableID
)