[
https://issues.apache.org/jira/browse/NIFI-10042?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brendan updated NIFI-10042:
---------------------------
Description:
When using expression language on Attribute and storing a reusable expression
as a parameter e.g get last day of month based on todays date
the if Else condition will treat the parameters as raw text and not validate
the expression in the parameter.
e.g
{code:json}
{code:json}
${data_quality_performance_as_of_date
:isEmpty()
:not()
:ifElse(
${data_quality_performance_as_of_date
:toDate('yyyyMMdd')
:format('yyyy-MM-dd')
},
#{expression.end_of_last_month})
:format('yyyy-MM-dd')
}
)
}
{code}
Essentially the Expression would unpack to something like below but instead I
get the raw text expression set to my attribute.
{code:json}
${data_quality_performance_as_of_date
:isEmpty()
:not()
:ifElse(
${data_quality_performance_as_of_date
:toDate('yyyyMMdd')
:format('yyyy-MM-dd')
},
${now()
:toNumber()
:format('yyyy-MM-dd')
:toDate('yyyy-MM-dd', 'GMT')
:toNumber()
:minus(${
now()
:toNumber()
:format('dd')
:toNumber()
:multiply(86400)
:multiply(1000)
})
:format('yyyy-MM-dd')
}
)
}
{code}
The result is here in some cases you can use parameters in this expression but
the desired outcome is not as expected unless
> Expression ifElse Treats Parameter as Text.
> -------------------------------------------
>
> Key: NIFI-10042
> URL: https://issues.apache.org/jira/browse/NIFI-10042
> Project: Apache NiFi
> Issue Type: Bug
> Reporter: Brendan
> Priority: Major
>
> When using expression language on Attribute and storing a reusable expression
> as a parameter e.g get last day of month based on todays date
> the if Else condition will treat the parameters as raw text and not validate
> the expression in the parameter.
> e.g
> {code:json}
> {code:json}
> ${data_quality_performance_as_of_date
> :isEmpty()
> :not()
> :ifElse(
> ${data_quality_performance_as_of_date
> :toDate('yyyyMMdd')
> :format('yyyy-MM-dd')
> },
> #{expression.end_of_last_month})
> :format('yyyy-MM-dd')
> }
> )
> }
> {code}
> Essentially the Expression would unpack to something like below but instead I
> get the raw text expression set to my attribute.
> {code:json}
> ${data_quality_performance_as_of_date
> :isEmpty()
> :not()
> :ifElse(
> ${data_quality_performance_as_of_date
> :toDate('yyyyMMdd')
> :format('yyyy-MM-dd')
> },
> ${now()
> :toNumber()
> :format('yyyy-MM-dd')
> :toDate('yyyy-MM-dd', 'GMT')
> :toNumber()
> :minus(${
> now()
> :toNumber()
> :format('dd')
> :toNumber()
> :multiply(86400)
> :multiply(1000)
> })
> :format('yyyy-MM-dd')
> }
> )
> }
> {code}
> The result is here in some cases you can use parameters in this expression
> but the desired outcome is not as expected unless
--
This message was sent by Atlassian Jira
(v8.20.7#820007)