Skip to main content

I have encountered a problem when formating a datetime. A log is raising a warning when the value is null. In order to avoid warnings in log I try to setup a condition in AttributeManager. I would like to reuse (copy/paste) the condition definition so I try to use "@CurrentAttribute". It's working as expected in Attribute Value part, but not in the test condition (see attached image).

If I use 

@CurrentAttribute() ATTRIBUTE_HAS_A_VALUE

I get <null> results despite the attribute has a value. Any suggestion how to set up the condition for current attribute correctly?

 

current_att

@albinepro​ Do you have a small example workspace you can share with the configuration you're trying?


@albinepro​ Do you have a small example workspace you can share with the configuration you're trying?

@Mark Stoakes​ I have uploaded a sample workspace in the original question. There are 4 datetime manipulations in the AttributeManager, the last one "datum_uzavreni" is setup to @CurrentAtrribute adn outputs just nulls. If I setup it to the exact attribute as the rest of the conditions, it works as expected. Maybe I am missing something. thx


@Mark Stoakes​ I have uploaded a sample workspace in the original question. There are 4 datetime manipulations in the AttributeManager, the last one "datum_uzavreni" is setup to @CurrentAtrribute adn outputs just nulls. If I setup it to the exact attribute as the rest of the conditions, it works as expected. Maybe I am missing something. thx

@albinepro​ Thanks very much for the example. This would be a good use o @CurrentAttribute() . In it's current for, it won't work for this use case, but I'll see if we can change that.

Perhaps you could use DateTimeConverter to avoid the messages


@albinepro​ The reason this doesn't work as you'd like is because @CurrentAttribute() returns the value of the current attribute not the attribute name.  So if, say, the current attribute has a value of 123, then the condition @CurrentAttribute() ATTRIBUTE_HAS_A_VALUE will end up checking whether an attribute named 123 has a value.


@albinepro​ The reason this doesn't work as you'd like is because @CurrentAttribute() returns the value of the current attribute not the attribute name.  So if, say, the current attribute has a value of 123, then the condition @CurrentAttribute() ATTRIBUTE_HAS_A_VALUE will end up checking whether an attribute named 123 has a value.

Understood, thanks. Is there a function then that would return a current attribute name in order to use with ATTRIBUTE_HAS_A_VALUE?


Understood, thanks. Is there a function then that would return a current attribute name in order to use with ATTRIBUTE_HAS_A_VALUE?

@albinepro​ Sorry, not that I can think of.


Understood, thanks. Is there a function then that would return a current attribute name in order to use with ATTRIBUTE_HAS_A_VALUE?

For this particular case you could test if CurrentAttribute length was greater than 0 and only attempt the date formatting if that was the case


Understood, thanks. Is there a function then that would return a current attribute name in order to use with ATTRIBUTE_HAS_A_VALUE?

It would be the same as checking if ATTRIBUTE_HAS_A_VALUE. I just needed a generic statement to copy/paste the condition of an attribute. If Im checking length, I still need to define the name of attribute Im checking.


Understood, thanks. Is there a function then that would return a current attribute name in order to use with ATTRIBUTE_HAS_A_VALUE?

No, ATTRIBUTE_HAS_A_VALUE seems to work slightly differently. This sort of setup works for me

image


Understood, thanks. Is there a function then that would return a current attribute name in order to use with ATTRIBUTE_HAS_A_VALUE?

Ok, that could work if it doesn't actually need attribute name.


Reply