Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

To create a new dependent variable on ID which checked if the ID is greater than E44555.

Abhilasha_123
Tera Contributor

In catalog form we have a field Vendor ID where users put the value, we have to create a new dependent variable on ID which checked if the ID is greater than E44555 then only the new variable should be visible. How will we compare this value 

2 ACCEPTED SOLUTIONS

Astik Thombare
Tera Sage

Hi @Abhilasha_123 ,

 

you can achieve this with the help of onChange Catalog Client script . Write a catalog client script on Vendor ID Variable and write a code on it as per below -

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (newValue == '') {
		g_form.setDisplay('new_field', false);
        return;
    }

    if (newValue > 'E44555' && newValue != 'E44555') {
        g_form.setDisplay('new_field', true);
    } else {
        g_form.setDisplay('new_field', false);
    }
}

 

Scenario 1 - When form is loaded 

AstikThombare4_0-1712914518446.png

Scenario 2- When Value is less than 'E44555 'or equal to  is given

 

AstikThombare4_1-1712914610231.png

 

Scenario 3- When Value is more than 'E44555 '  is given

 

AstikThombare4_2-1712914679279.png

 

 

if my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

 

Thanks,

Astik

 

 

View solution in original post

Not applicable

Hi @Abhilasha_123 ,

I tried your problem in my PDI and I hope this will works for you

I created new "OnChange" Client script your can refer below code 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    alert("ID - " + g_form.getValue('id'));
    alert("ID New Value - " + newValue);
    if (newValue > g_form.getValue('id')) {
               alert('New Id value is greate ');
		g_form.setDisplay('new_id_value', true);// show new ID Value
    } else {
                alert('New Id value is smaller');
		g_form.setDisplay('new_id_value', false);// Not show new ID Value
    }

}

 

Here the result 

SarthakKashya2_0-1712913860359.png

 

I added smaller number New ID value will removed 

SarthakKashya2_1-1712913886230.png

 

Please mark Correct and Helpful if this works for you

 

Thanks and Regards 

Sarthak

 

 

View solution in original post

2 REPLIES 2

Astik Thombare
Tera Sage

Hi @Abhilasha_123 ,

 

you can achieve this with the help of onChange Catalog Client script . Write a catalog client script on Vendor ID Variable and write a code on it as per below -

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (newValue == '') {
		g_form.setDisplay('new_field', false);
        return;
    }

    if (newValue > 'E44555' && newValue != 'E44555') {
        g_form.setDisplay('new_field', true);
    } else {
        g_form.setDisplay('new_field', false);
    }
}

 

Scenario 1 - When form is loaded 

AstikThombare4_0-1712914518446.png

Scenario 2- When Value is less than 'E44555 'or equal to  is given

 

AstikThombare4_1-1712914610231.png

 

Scenario 3- When Value is more than 'E44555 '  is given

 

AstikThombare4_2-1712914679279.png

 

 

if my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

 

Thanks,

Astik

 

 

Not applicable

Hi @Abhilasha_123 ,

I tried your problem in my PDI and I hope this will works for you

I created new "OnChange" Client script your can refer below code 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    alert("ID - " + g_form.getValue('id'));
    alert("ID New Value - " + newValue);
    if (newValue > g_form.getValue('id')) {
               alert('New Id value is greate ');
		g_form.setDisplay('new_id_value', true);// show new ID Value
    } else {
                alert('New Id value is smaller');
		g_form.setDisplay('new_id_value', false);// Not show new ID Value
    }

}

 

Here the result 

SarthakKashya2_0-1712913860359.png

 

I added smaller number New ID value will removed 

SarthakKashya2_1-1712913886230.png

 

Please mark Correct and Helpful if this works for you

 

Thanks and Regards 

Sarthak