Skip to content

Commit 21d1037

Browse files
committed
Fixed bug in exists function.
1 parent 5c34018 commit 21d1037

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ClassLibrary/DataWarehouseAutomation/DataWarehouseAutomation/HandleBarsHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ public static void RegisterHandleBarsHelpers()
257257
var searchString = arguments[0] == null ? "" : arguments[0].ToString();
258258
DataObjectMapping dataObjectMapping = JsonSerializer.Deserialize<DataObjectMapping>(context.Value.ToString());
259259

260-
var dataItemExists = dataObjectMapping.DataItemMappings.Select(x => x.TargetDataItem.Name == searchString).FirstOrDefault();
260+
var dataItemExists = dataObjectMapping.DataItemMappings.Where(x => x.TargetDataItem.Name == searchString).FirstOrDefault();
261261

262-
if (dataItemExists)
262+
if (dataItemExists != null)
263263
{
264264
// Regular block
265265
options.Template(output, context);

ClassLibrary/DataWarehouseAutomation/Sample_Templates/TemplateSampleCustomFunctions.Handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Found a data item mapping from {{sourceDataItems.0.name}} to {{targetDataItem.na
2525

2626
{{#targetDataItemExists "FIRST_NAME"}}FIRST_NAME exists{{else}}FIRST_NAME does not exist{{/targetDataItemExists}}
2727
{{#targetDataItemExists "NAME"}}NAME exists{{else}}NAME does not exist{{/targetDataItemExists}}
28+
{{#targetDataItemExists "DATE_OF_BIRTH"}}NAME exists{{else}}NAME does not exist{{/targetDataItemExists}}
2829

2930
-- End of mapping
3031
{{/each}}

0 commit comments

Comments
 (0)