select any one segmented - on any event

{ view: "segmented", id: "inoutsegment", multiview: true, align: "center", click: "OnSegmentClick", options: [ { value: 1, label: "IN" }, { value: 2, value: "OUT" }, { value: 3, value: "IN-OUT"}] }

I want to select any segmented in a function how can I do it ?

function is as follows but not working. Please suggest.

[code]function setINOutSegmentDefaultSelection() {
if (jsoniolist.length > 0) {
if (true) {
$$(“inoutsegment”).Value = 2;

            }
            else {
                $$("inoutsegment").Value = 1;
            }
            $$("inoutsegment").refresh();
        }
    }[/code]

Hello,

you can call setValue method and pass the value of the option that you want to select

$$(“inoutsegment”).setValue(2);