"Specificed cast not valid" when using session variable in aggegrate or logic

When I try to use a session variable in an aggegrate (filter) or logic (if) then the message appears: "Specificed cast not valid"

The types are the same (Product Identifier).

I reconstructed the scenario in a very small application (only this problem).

Anyone any suggestions?
Hi Peter,

Try to change the IntegerToIdentifier() with the LongIntegerToIdentifier().
Hi Peter,

This is a platform bug. See this topic for more details. OutSystems should be aware of it (I informed them a while ago), but it doesn't hurt to let them know you encountered it as well (support@outsystems.com).
Hi André,

Changing to LongIntegerToIdentifier did work. But I don't have to choose for the platform if the value 1 should be intepreted as a IntegerToIdentifier or all LongIntegerToIdentifier. The value is in range of both types and the result should be and Indentifier and it should matter if it's coming from an Integer or LongInteger.

So this is indeed a bug from my point of view.
Peter, you're right. Like Kilian mentioned above, this is a platform a bug. Changing the function is just a workaround I've suggested.