-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.ts
620 lines (579 loc) · 26.1 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
import { getUserApiKey } from './auth';
import { TogglApi, usedTogglResponseTypes, usedToggleResponseEntriesTypes } from './toggl';
import { Converters, recurseFromString, myConsole, DateUtils, Exceptions, CacheWrapper } from './helpers';
import { responseTemplate } from './toggl-types';
import { fieldMapping, myFields } from './fields';
import { GetDataReturnObj, GetDataRequest, SchemaRequest, DataReturnObjRow } from './gds-types';
import { debugLevels } from './setup';
/**
* @author Joshua Tzucker
* @file main.ts
* Note: @override is used to denote function that is required and expected by connector implementation
* REMINDER: DO NOT USE 'GoogleAppsScript' in a way that will force it to show up in generated JS. Should only be used as interface; does not actually exist as obj in GAS online.
* - That is why I have called some enums at the start and stored as var, so they can be referenced instead
* @TODO - How to deal with currency?
* - I could always return USD, and leave it up to user to know what their Toggl setting is and convert on their own...
* - I have to tell GDS the currency in advance, so if I wanted it to be dynamic based on Toggl setting, I would have to make double API calls...
* - Messy but reliable option: make a field for every single currency Toggl might return, and then map based on response
* @TODO - handle "alltime" query?
*/
/**
* MAIN - Setup globals
*/
// init connector
var cc = DataStudioApp.createCommunityConnector();
// Create global instance of toggl api class
export var togglApiInst = new TogglApi(getUserApiKey());
/**
* @override
* This is used by Data Studio to build the configuration UI screen that the user enters settings on first run
*/
function getConfig() {
// Get config obj provided by gds-connector
let config = cc.getConfig();
// Get list of workspace IDs that the user has access to
let foundWorkspaces = false;
try {
let workspaceResponse = togglApiInst.getWorkspaceIds();
if (workspaceResponse.success && Array.isArray(workspaceResponse.raw)) {
let workspaceArr: any[] = workspaceResponse.raw;
let workspaceSelectConfigField = config
.newSelectSingle()
.setId('workspaceId')
.setName('Toggl Workspace')
.setHelpText('Select the Workspace to pull data from')
.setAllowOverride(false);
for (let x = 0; x < workspaceArr.length; x++) {
let currWorkspace = workspaceArr[x];
workspaceSelectConfigField.addOption(
config.newOptionBuilder().setLabel(currWorkspace.name).setValue(currWorkspace.id.toString())
);
}
foundWorkspaces = true;
}
} catch (e) {
foundWorkspaces = false;
}
if (!foundWorkspaces) {
// Fallback to plain text field
config
.newTextInput()
.setId('workspaceId')
.setName('Toggl Workspace ID')
.setHelpText('Numerical ID for your workspace')
.setPlaceholder('123456');
}
// Set config general info
config.newInfo().setId('instructions').setText('Configure the connector for Toggl');
// Require workspace ID (necessary for all report API calls)
// Allow pre-filtering to just billable time
config
.newCheckbox()
.setId('prefilterBillable')
.setName('Pre-filter Billable')
.setHelpText('Pre-filter all reports to just "billable" time (as configured in Toggl)');
// Require date range to be sent with every data request
config.setDateRangeRequired(true);
// Make sure to return the built config
return config.build();
}
/**
* Add a custom field to a connector
* @param fieldsObj - an existing group of fields, generated through connector.getFields();
* @param fieldToAdd - New field to add to connector, following internal syntax
*/
function addField(fieldsObj: GoogleAppsScript.Data_Studio.Fields, fieldToAdd: fieldMapping) {
let chain: GoogleAppsScript.Data_Studio.Field;
// Dimension vs Metric
if (fieldToAdd.semantics.conceptType === 'DIMENSION') {
chain = fieldsObj.newDimension();
} else {
chain = fieldsObj.newMetric();
}
// Field ID and Name
chain.setId(fieldToAdd.id);
chain.setName(fieldToAdd.name);
// OPT: Description
if (typeof fieldToAdd.description === 'string') {
chain.setDescription(fieldToAdd.description);
}
// Semantics
chain.setType(fieldToAdd.semantics.semanticType);
if (fieldToAdd.semantics.isReaggregatable && typeof fieldToAdd.semantics.aggregationType !== 'undefined') {
chain.setIsReaggregatable(true);
chain.setAggregation(fieldToAdd.semantics.aggregationType);
}
// Custom Formula / Calculated Field
if (fieldToAdd.formula && fieldToAdd.formula.length > 0) {
chain.setFormula(fieldToAdd.formula);
}
// Return the whole field object
return chain;
}
/**
* @override
* Kept as separate function from getSchema, so it can be reused with getData()
* https://developers.google.com/datastudio/connector/reference#getschema
* List of types: https://developers.google.com/datastudio/connector/reference#datatype
*/
function getFields() {
let fields = cc.getFields();
let fieldKeys = Object.keys(myFields);
for (let x = 0; x < fieldKeys.length; x++) {
addField(fields, myFields[fieldKeys[x]]);
}
return fields;
}
/**
* @override
*/
function getSchema(request: SchemaRequest) {
return { schema: getFields().build() };
}
/**
* @override
* https://developers.google.com/datastudio/connector/reference#getdata
* Should return: https://developers.google.com/datastudio/connector/reference#response_3
* - Schema and rows should match in length (one should be the dimension used)
* - Response should match what was requested {request.fields}
* - Data types - https://developers.google.com/datastudio/connector/reference#semantictype
* Notes:
* - Badly documented, but the array of field names [{name:"foobar"}] is misleading - they are not names, they are the original IDs of the fields...
* - Furthermore, schema should be the result of Fields.build(), which has specialized output that looks like this:
* // [{
* // "dataType": "STRING",
* // "name": "day",
* // "label": "Date",
* // "semantics": {
* // "conceptType": "DIMENSION",
* // "semanticType": "YEAR_MONTH_DAY"
* // }
* // }, {
* // "dataType": "STRING",
* // "name": "time",
* // "description": "Logged Time",
* // "label": "Time",
* // "semantics": {
* // "isReaggregatable": true,
* // "conceptType": "METRIC",
* // "semanticType": "DURATION"
* // }
* // }]
* - Rows is also confusing - instead of each column (dimension|metric) being an object with a values array that contains rows, it is that each row is an object with a values array that contains columns.
*/
function getData(request: GetDataRequest) {
myConsole.log(request, debugLevels.MEDIUM);
let now: Date = new Date();
let userCache: GoogleAppsScript.Cache.Cache = CacheService.getUserCache()!;
// Grab fields off incoming request
let unorderedRequestedFieldIds: Array<string> = request.fields.map((field) => field.name); // ['day','time','cost',...]
let requestedFields: GoogleAppsScript.Data_Studio.Fields = getFields().forIds(unorderedRequestedFieldIds);
let orderedRequestedFieldIds = requestedFields.asArray().map((field) => {
return field.getId() || '';
});
// What the final result should look like
let returnData: GetDataReturnObj = {
cachedData: false,
schema: requestedFields.build(),
rows: []
};
// FLAG - request is missing required info
let blocker: boolean = false;
let blockerReason: string = '';
// FLAG - is there a reason to avoid using cache?
let avoidCache: boolean = false;
let foundInCache: boolean = false;
// Grab date stuff off incoming request
let lastRefreshedTime: Date;
if (typeof request.scriptParams === 'object' && typeof request.scriptParams.lastRefresh === 'string') {
lastRefreshedTime = new Date(request.scriptParams.lastRefresh);
} else {
lastRefreshedTime = new Date(new Date().getTime() - 12 * 60 * 60 * 1000);
}
let dateRangeStart: Date = DateUtils.forceDateToStartOfDay(
Converters.gdsDateRangeDateToDay(request.dateRange.startDate)
);
let dateRangeEnd: Date = DateUtils.forceDateToEndOfDay(Converters.gdsDateRangeDateToDay(request.dateRange.endDate));
// Avoid cache if either end of range is within 2 days of today - since users are more likely to have recently edited entries within that span
if (
DateUtils.getIsDateWithinXDaysOf(dateRangeStart, now, 2) ||
DateUtils.getIsDateWithinXDaysOf(dateRangeEnd, now, 2)
) {
avoidCache = true;
}
// Certain things in what is requested can change how route used to retrieve data...
let canUseDetailedReport = true;
let canUseWeeklyProjectReport = true;
let canUseWeeklyUserReport = true;
let canUseSummaryReport = true;
for (let x = 0; x < orderedRequestedFieldIds.length; x++) {
let fieldId = orderedRequestedFieldIds[x];
canUseDetailedReport = !canUseDetailedReport
? canUseDetailedReport
: getIsFieldInResponseEntryType(fieldId, 'TogglDetailedEntry');
canUseWeeklyProjectReport = !canUseWeeklyProjectReport
? canUseWeeklyProjectReport
: getIsFieldInResponseEntryType(fieldId, 'TogglWeeklyProjectGroupedEntry');
canUseWeeklyUserReport = !canUseWeeklyUserReport
? canUseWeeklyUserReport
: getIsFieldInResponseEntryType(fieldId, 'TogglWeeklyUserGroupedEntry');
canUseSummaryReport = !canUseSummaryReport
? canUseSummaryReport
: getIsFieldInResponseEntryType(fieldId, 'TogglSummaryEntry');
}
let dateDimensionRequired: boolean = orderedRequestedFieldIds.indexOf('day') !== -1;
let projectDimensionRequired: boolean =
orderedRequestedFieldIds.indexOf('projectId') !== -1 || orderedRequestedFieldIds.indexOf('projectName') !== -1;
// Config options
let workspaceId: number = -1;
let prefilterBillable = false;
// Extract config configParams
if (request.configParams && typeof request.configParams === 'object') {
if (typeof request.configParams['workspaceId'] !== 'undefined') {
try {
workspaceId = parseInt(request.configParams['workspaceId'], 10);
} catch (e) {
blocker = true;
blockerReason = 'Workspace ID is required for all requests!';
}
} else {
blocker = true;
blockerReason = 'Workspace ID is required for all requests!';
}
prefilterBillable = request.configParams['prefilterBillable'] == true;
}
// Early return if anything is missing
if (blocker) {
cc.newUserError().setDebugText(blockerReason).setText(blockerReason).throwException();
return false;
}
try {
if (!dateDimensionRequired && canUseSummaryReport) {
// If dateDimensionRequired is false, and uses has requested project or client details, we can query the summary endpoint and group by project|client
let grouping: 'projects' | 'clients' = projectDimensionRequired ? 'projects' : 'clients';
let res: responseTemplate = TogglApi.getResponseTemplate(false);
let cacheKey: string = CacheWrapper.generateKeyFromInputs([
workspaceId,
dateRangeStart,
dateRangeEnd,
grouping,
'time_entries',
prefilterBillable
]);
if (!avoidCache) {
try {
let cacheValue: null | string = userCache.get(cacheKey);
if (cacheValue) {
res = JSON.parse(cacheValue);
foundInCache = true;
myConsole.log('Used Cache!', debugLevels.HIGH);
}
} catch (e) {
foundInCache = false;
}
}
if (!foundInCache) {
res = togglApiInst.getSummaryReport(
workspaceId,
dateRangeStart,
dateRangeEnd,
grouping,
'time_entries',
prefilterBillable
);
myConsole.log('No cache used for response', debugLevels.HIGH);
}
if (res.success) {
// Map to getData rows
returnData.rows = mapTogglResponseToGdsFields(
requestedFields,
orderedRequestedFieldIds,
dateRangeStart,
dateRangeEnd,
res.raw,
usedTogglResponseTypes.TogglSummaryReportResponse,
usedToggleResponseEntriesTypes.TogglSummaryEntry,
grouping
);
if (!foundInCache && returnData.rows.length > 0) {
// Cache results
userCache.put(cacheKey, JSON.stringify(res));
}
returnData.cachedData = foundInCache;
return returnData;
} else {
return Exceptions.throwGenericApiErr();
}
} else if (!dateDimensionRequired && (canUseWeeklyProjectReport || canUseWeeklyUserReport)) {
// @TODO
cc.newDebugError()
.setText('getData request resulted in trying to use getWeeklyReport, which has not been built yet')
.throwException();
} else if (dateDimensionRequired || canUseDetailedReport) {
myConsole.log('dateDimensionRequired', debugLevels.HIGH);
// The only request type that a date dimension is the detailed report
let res: responseTemplate = TogglApi.getResponseTemplate(false);
let cacheKey: string = CacheWrapper.generateKeyFromInputs([
workspaceId,
dateRangeStart,
dateRangeEnd,
prefilterBillable
]);
if (!avoidCache) {
try {
let cacheValue: null | string = userCache.get(cacheKey);
if (cacheValue) {
res = JSON.parse(cacheValue);
foundInCache = true;
myConsole.log('Used Cache!', debugLevels.HIGH);
}
} catch (e) {
foundInCache = false;
}
}
if (!foundInCache) {
res = togglApiInst.getDetailsReportAllPages(
workspaceId,
dateRangeStart,
dateRangeEnd,
prefilterBillable
);
myConsole.log('No cache used for response', debugLevels.HIGH);
}
if (res.success) {
// Map to getData rows
returnData.rows = mapTogglResponseToGdsFields(
requestedFields,
orderedRequestedFieldIds,
dateRangeStart,
dateRangeEnd,
res.raw,
usedTogglResponseTypes.TogglDetailedReportResponse,
usedToggleResponseEntriesTypes.TogglDetailedEntry
);
if (!foundInCache && returnData.rows.length > 0) {
// Cache results
userCache.put(cacheKey, JSON.stringify(res));
}
returnData.cachedData = foundInCache;
myConsole.log(returnData, debugLevels.HIGH);
return returnData;
} else {
return Exceptions.throwGenericApiErr();
}
} else {
cc.newUserError()
.setDebugText('No API call was made, could not determine endpoint based on dimensions requested')
.setText('Invalid combination of dimensions')
.throwException();
myConsole.error(
'No API call was made, could not determine endpoint based on dimensions requested',
debugLevels.LOW
);
}
} catch (err: any) {
cc.newUserError()
.setDebugText(err.toString())
.setText('Something went wrong fetching from Toggl')
.throwException();
myConsole.error(err, debugLevels.LOW);
}
}
/**
* @override
*/
function isAdminUser() {
// No spam please :)
let email: string = 'am9zaHVhLnR6QGdtYWlsLmNvbQ==';
return Utilities.base64EncodeWebSafe(Session.getEffectiveUser().getEmail(), Utilities.Charset.UTF_8) === email;
}
/**
* Maps a Toggl API response to GDS formatted rows to return inside getData()
* Things to note:
* - Everything needs to be aggregated by dimension and # needs to match; e.g. if GDS requests two dimensions (columns), only two data points per row should be returned
* @param requestedFields
* @param requestedFieldIds
* @param requestedStart
* @param requestedEnd
* @param response
* @param responseType
* @param entryType
* @param requestedGrouping
*/
function mapTogglResponseToGdsFields(
requestedFields: GoogleAppsScript.Data_Studio.Fields | null,
requestedFieldIds: Array<string>,
requestedStart: Date,
requestedEnd: Date,
response: { [index: string]: any },
responseType: usedTogglResponseTypes,
entryType: usedToggleResponseEntriesTypes,
requestedGrouping?: 'projects' | 'clients' | 'users'
) {
// Need to get literal string key from enum
let entryTypeStringIndex: string = usedToggleResponseEntriesTypes[entryType];
let mappedData: Array<DataReturnObjRow> = [];
response.data = Array.isArray(response.data) ? response.data : [];
let entryArr = response.data;
if (responseType === usedTogglResponseTypes.TogglSummaryReportResponse) {
// Each summary entry also contains a sub-array of entries that are grouped to that summary item. I am going to copy up and reaggregate certain values off that subarray, adding them to the parent entry
// For example, one entry with three sub items would stay one entry, but have the averages of those three subitems added as new props
for (let x = 0; x < entryArr.length; x++) {
let entryBase = entryArr[x];
if (Array.isArray(entryBase['items']) && entryBase.items.length > 0) {
let cBillingRate = 0;
let totalBillingSum = 0;
let totalBillingTime = 0;
for (let s = 0; s < entryBase.items.length; s++) {
let subItem = entryBase.items[s];
cBillingRate += typeof subItem.rate === 'number' ? subItem.rate : 0;
let subItemBillingSum = typeof subItem.sum === 'number' ? subItem.sum : 0;
totalBillingSum += subItemBillingSum;
if (subItemBillingSum > 0) {
// Time was billable
totalBillingTime += subItem.time;
}
}
// Add calculated
entryBase['avgBillingRate'] = cBillingRate / entryBase.items.length;
entryBase['totalBillingSum'] = totalBillingSum;
entryBase['totalBillingTime'] = totalBillingTime;
}
}
}
let suppressedRowCount: number = 0;
// Loop over response entries - [ROWS]
for (let x = 0; x < entryArr.length; x++) {
// Flag - suppress row being passed to GDS
let suppressRow: boolean = false;
let entry = entryArr[x];
let row: DataReturnObjRow = {
values: []
};
// lets do some pre-processing, per entry
if (responseType === usedTogglResponseTypes.TogglDetailedReportResponse) {
// If billable, copy time amount as new prop
if (entry.isBillable === true) {
entry['billableTime'] = entry.dur;
}
} else if (responseType === usedTogglResponseTypes.TogglSummaryReportResponse) {
// Summary reports can be grouped - and the ID field in response changes to match
if (requestedGrouping === 'projects') {
entry['pid'] = entry.id;
} else if (requestedGrouping === 'clients') {
entry['cid'] = entry.id;
} else if (requestedGrouping === 'users') {
entry['uid'] = entry.id;
}
} else if (responseType === usedTogglResponseTypes.TogglWeeklyReportResponse) {
// @TODO ?
}
// Iterate over requested fields [COLUMNS]
for (let x = 0; x < requestedFieldIds.length; x++) {
let fieldMapping = myFields[requestedFieldIds[x]];
// Make sure to pass *something* to GDS for every requested field!
let valueToPass: any = null;
if (fieldMapping) {
valueToPass = extractValueFromEntryWithMapping(entry, fieldMapping, entryTypeStringIndex);
}
if (fieldMapping.id === 'day' && fieldMapping.semantics.conceptType === 'DIMENSION') {
// !!! - Special - !!!
// Sometimes Toggl will return entries that overlap days. This can lead to the dreaded "number of columns returned don't match requested" error from GDS if blinding returning a date that GDS did not actually request.
if (typeof fieldMapping.togglMapping === 'object') {
// Take care to make copy so not modifying reference
let augmentedMapping: fieldMapping = {
id: fieldMapping.id,
name: fieldMapping.name,
semantics: fieldMapping.semantics,
togglMapping: {
fields: fieldMapping.togglMapping.fields,
formatter: (date: string) => {
// Convert Toggl date to true Date Obj
// Note - Toggl includes Timezone with date ("start":"2019-06-28T18:54:50-07:00"), so remove it to make compatible with checking date range (with uses GMT)
let convertedDate: Date = new Date(
date.replace(/(\d{4}-\d{2}-\d{2}T[^-]+-).*/, '$100:00')
);
return convertedDate;
}
}
};
let fieldDate: Date = extractValueFromEntryWithMapping(
entry,
augmentedMapping,
entryTypeStringIndex
);
if (!DateUtils.getIsDateInDateTimeRange(fieldDate, requestedStart, requestedEnd)) {
suppressRow = true;
suppressedRowCount++;
}
}
}
row.values.push(valueToPass);
}
// Push the entire entry row to results
if (!suppressRow) {
mappedData.push(row);
}
}
if (suppressedRowCount > 0) {
myConsole.log(
'Suppressed ' + suppressedRowCount.toString() + ' rows based on misaligned date',
debugLevels.HIGH
);
}
return mappedData;
}
/**
* Extracts the value from a Toggl API response entry, and converts it based on the destination GDS column
* @param entry {object} - An entry off a Toggl API response
* @param fieldMapping {fieldMapping} - My stored mapping of fields. Should contain semantics
* @param entryTypeStringIndex {string} - Toggl entry type enum, converted to string
* @return {any} - always returns a value, with VALUE_FOR_NULL global being the placeholder if no mapping was found. GDS always expects a value in column
*/
function extractValueFromEntryWithMapping(
entry: { [index: string]: any },
fieldMapping: fieldMapping,
entryTypeStringIndex: string
): any {
let extractedValue: any = VALUE_FOR_NULL;
let togglMapping = fieldMapping.togglMapping;
if (togglMapping) {
// Look up the individual field mappings
let fields = togglMapping.fields[entryTypeStringIndex];
if (fields) {
// Iterate over field keys
let foundVals: Array<any> = [];
for (let x = 0; x < fields.length; x++) {
let val: any = recurseFromString(entry, fields[x]);
if (typeof val !== 'undefined') {
foundVals.push(val);
}
}
if (foundVals.length > 0) {
if ('formatter' in togglMapping && typeof togglMapping['formatter'] === 'function') {
extractedValue = togglMapping.formatter.apply(entry, foundVals);
} else {
// Assume we only want first val
extractedValue = foundVals[0];
}
} else {
Logger.log('No required fields were found for mapping of "' + fieldMapping.id + '"');
}
}
}
extractedValue = typeof extractedValue !== 'undefined' ? extractedValue : VALUE_FOR_NULL;
return extractedValue;
}
/**
* Check if a given field can be found in the interface for the given response entry type (from the API)
* @param fieldId {string} - The ID of a field to check
* @param entryTypeStringIndex {string} - The string representation of a Toggl entry type (should correspond to usedToggleResponseEntriesTypes enum)
* @returns {boolean}
*/
function getIsFieldInResponseEntryType(fieldId: string, entryTypeStringIndex: string): boolean {
let fieldMapping = myFields[fieldId].togglMapping;
if (fieldMapping) {
return Array.isArray(fieldMapping.fields[entryTypeStringIndex]);
}
return false;
}