-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sub API Parameters
57 lines (38 loc) · 1.4 KB
/
Sub API Parameters
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
/*
Parameters Sub: Create a string from parameters and parameter values in table
1. Loop through the expansion hyperlinks
2. Create a comma seperated list of expansions
3. Make the parameter expand = comma seperated list
1. Loop through Inline Table Parameters
2. Create a string with '&' between each parameter
3. Set the string equal to variable 'params'
*/
SUB Parameters;
//Embedded Links
IF NoOfRows('expand') > 0 THEN
SET expand = ;
Let vNoOfRows = NoOfRows('expand');
FOR i=0 to $(vNoOfRows)-1
LET expand = '$(expand)' & peek('Value',$(i),'expand') & IF($(i)=$(vNoOfRows)-1,NULL(),','); //Really Long Comma Seperated String
NEXT i;
DROP TABLE expand;
//LET expand =;
TRACE Created the Expand Parameter: $(expand);
ELSE
TRACE No Expand Parameter Created;
END IF
//Parameters
IF NoOfRows('Parameters') > 0 OR len('$(expand)') > 0 THEN
SET params = ;
Let vNoOfRows = NoOfRows('Parameters');
FOR i=0 to $(vNoOfRows)-1
LET params = '$(params)' & peek('Parameter',$(i),'Parameters') &'='& peek('Value',$(i),'Parameters') & IF($(i)=$(vNoOfRows)-1,NULL(),'&'); //Parameter = ParameterValue
NEXT i;
DROP TABLE Parameters;
//LET params = '$(expand)' & '$(params)';
LET expand =;
TRACE Created the Parameters String: $(params);
ELSE
TRACE No Parameters Created;
END IF
END SUB;