Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Changing an object's presence based on an amount range AND a Pull-Down Selection

Eric_Rosenfeld
Level 2
Level 2

Hi,

I have a form that changes various object's presence based on an amount range similar to this:

switch (true)

{

case this.rawValue >= 1 && this.rawValue <= 49999:

Subhead1.presence = "visible";

Subhead2.presence = "hidden";

break;

case this.rawValue >= 50000 && this.rawValue <= 250000:

Subhead1.presence = "hidden";

Subhead2.presence = "visible";

break;

default:

Subhead1.presence = "hidden";

Subhead2.presence = "hidden";

}

As an enhancement, I would like to add a pull-down selection field that changes the amount ranges based on the pull-down selection.

Can anyone offer any advice?

Thanks,

Eric

1 Reply
_Bruce_Robertson
Level 10
Level 10

Hi Eric,

Here's one approach, there would be many especially if there is some sort of formula defining the min and max values.  With this approach I am assuming there isn't and the drop down values are Small, Medium and Big,

var ranges

switch (DropDownList1.rawValue)

{

    case "Small":

        ranges = { option1 : {min:0, max:499}, option2 : {min:500, max:2500} };

        break;

    case "Medium": ranges = { option1 : {min:0, max:4999}, option2 : {min:5000, max:25000} };

        break;

    default: ranges = { option1 : {min:0, max:49999}, option2 : {min:50000, max:250000} };

        break;

}

switch (true)

{

    case this.rawValue >= ranges.option1.min && this.rawValue <= ranges.option1.max:

        Subhead1.presence = "visible";

        Subhead2.presence = "hidden";

        break;

    case this.rawValue >= ranges.option2.min && this.rawValue <= ranges.option2.max:

        Subhead1.presence = "hidden";

        Subhead2.presence = "visible";

        break;

    default:

        Subhead1.presence = "hidden";

        Subhead2.presence = "hidden";

}

Regards

Bruce