Start a new topic
Answered

Enriching an Lov with 0

Hi, 

I have built an enricher based on a boolean value, it needs to enrich an LOV, logic can be seen below, 

The first part works, where the Product.FridgeMaterialFlag is selected the 1 value is selected in the LOV, however the next part when the Product.FridgeMaterialFlag is not selected the LOV goes to null and not to 0, your guidance on how to resolve this would be much appreciated. I have two other scenarios like this, some guidance would be much appreciated. 


Logic

Case  

when Product.FridgeMaterialFlag = 1 then 1

when Product.FridgeMaterialFlag (boolean) = 0 then 0

end


Best Answer

Hello


To achieve the above requirement of enriching the child Lov when the Boolean attribute is checked in the parent entity

You need to add this expression in your child enricher


Case  

when test.testflag = '1' then 1

else 0

end


the above expression works fine when we are using postgres as the Database


but if we have sql server as the database 

In the semql of enricher you need to type 1 and zero with inverted commas
then it will work fine
it is just because the sql server does not type cast it on its own




Answer

Hello


To achieve the above requirement of enriching the child Lov when the Boolean attribute is checked in the parent entity

You need to add this expression in your child enricher


Case  

when test.testflag = '1' then 1

else 0

end


the above expression works fine when we are using postgres as the Database


but if we have sql server as the database 

In the semql of enricher you need to type 1 and zero with inverted commas
then it will work fine
it is just because the sql server does not type cast it on its own



So I have followed your above guidance and nothing is working now

Keep the condition as given below for enricher 1 as well

And in the form enricher tab of stepper keep it as on data change for both the enricher not on form open 

Hi,

Thanks for the guidance on this, I followed what your process of creating a second enricher and but I am getting the same result as soon as the flag is unticked the Class Keep Cool goes to null not 0

see screen prints below Enricher 1 (working) enricher 2 (not working)

Hello Paul,


To achieve this requirement we need to create two enricher to check both the conditions in two different enricher and also update it respectively


Create the first enricher to update the value of LOV as 1 with the filter as flag='1'  as shown below

image


Create the second enricher with the second condition this will update the value of LOV as 0

image


now active both the enricher in stepper on data change


image

image




Hi Paul,


after trying to reproduce your issue, I think I might have understood the root cause for your problem. If you want to enrich the LOV value "live", and have set the enricher to be run during the stepper "on data change", then the enricher is not triggered at all if the boolean value is not clicked by the user (thus not "changed"). When I also select "on form open", then the LOV value is set by default and updated if the user clicks on the boolean field.

Can you check it as well and give another try ?


Thanks for the update.

Stéphanie.


Hi Stephanie, 

Unfortunately that does not work, the field that the enricher is meant to be populating populates for the positive (when Product.FridgeMaterialFlag = 1 then 1), however when the when FridgeMaterialFlag is unticked the value that I need it to populate is 0 (field that the enricher is run on) however it is recording Null (blank field) 

Hi Paul,


by default, the attribute values are equal to null when creating records. Did you try this?

I hope this helps.

Stéphanie.


Case  

when Product.FridgeMaterialFlag = 1 then 1

else 0

end

Login to post a comment