Custom Parameters in Root container not behaivig as expected

I am setting up a view where we can easily edit our information. I have set up custom parameters in the root container that point to the old and new values so that I can run a script to update our table. The “new” params coalesce any potential change and the original values, but aren’t pulling any info and I am not sure why. Here is how it’s set up:

Old_CustomerID - Expression Binding:
./OldContainer/SelectCustomerDropdown.props.value
New_CustomerID - Expression Binding:
coalesce({./NewContainer/ChangeSiteDropdown.props.value},{./OldContainer/SelectSiteDropdown.props.value})

I have also tried:

New_CustomerID - Expression Binding:
coalesce({./NewContainer/ChangeCustomerDropdown.props.value},{this.custom.Old_CustomerID})

The expression winds up blank each way.

I figured that keeping the params in the root container would make them accessible by both sub containers. Is that not the case? Is there a limit to how many I can make? Is the Coalesce not working the way I expect?

Any advice appreciated - I’ve tried many different things. Next I will try removing the containers, but I like having them there, if nothing else, for organization.

The default value for unpopulated components in Perspective is not null; it’s more like it’s an empty string. So, your coalesces are returning the empty default value because it’s the first non-null value it sees. For example, here’s a binding with a coalesce where you might expect the second argument to be the return value, but it’s giving us that default empty value instead:

(Aside, I’d like to put forward that the way you’re going about this might be complicating things. If you need to keep track of previous values vs. current values and perform some logic on them, you might consider just making one set of properties and then putting property change scripts on them, which gives you access to the previousValue and currentValue whenever the property changes.)

1 Like

Excellent - Solved. Thank you Sir!

I’ll try the property change scripts. I’m very new to this and just trying to get things to work at this point. I was pretty sure that was a sloppy way to do it, but the simplicity of it was appealing at the time.

(Aside, you’re right, No one expects The Spanish Inquisition!)

Edit - fyi, I used an if(x="",y,x) expression to get them to work.

1 Like

It’s exactly an empty string. Within the property editor, you can type the literal string null to get an actual null value, which is one of the relatively few primitive types in JSON.

Thank you for confirming! I wish there was an elegant way to convey to the user that it’s an empty string within the property designer. When I was starting out, it gave me grief trying to figure out that the value was a blank and not a null (and it looks like I wasn’t the only one who misinterpreted it!).