Skip to main content
13-Aquamarine
Mar 27, 2024 7:03 AM UTC
Solved

validate a text when we enter in TextField in mashup

Hello,

I want to validate a ThingName in thingworx. Like In Mashup, when I type a thing name in textbox field and enter on click button, the validator function should be check the thing which we have enter in textbox field is already available or not, if  yes the message should be Thing Created Successfully and if not then should be Thing Already Exist.

So how can we do that?

Pratik_A_0-1711522972375.png

 

 

Thanks.

VelkumarAnswer
19-Tanzanite
Mar 28, 2024 7:59 AM UTC

Hi @Pratik_Aswale 

 

Instead of Clicked Event to show a status message. Use ServiceInvokeCompleted Event from the service to trigger/show popup message.

 

/VR

8 replies

Rocko
19-Tanzanite
Mar 27, 2024 12:54 PM UTC

Instead of using validators, you could have the service where you create the thing return a status message with either success or failure message.

Translate
19-Tanzanite
Mar 27, 2024 1:25 PM UTC

Hi @Pratik_Aswale 

 

You cannot use the validator function to check whether Thing exists.

 

As @Rocko said you can use the service to validate it. Something like this

let result = "Thing already exist";
if(!Things[thingName])
{
 //Put your Script to create Thing
 
 result = "Thing created successfully";
}

 

/VR

Translate
13-Aquamarine
Mar 28, 2024 5:56 AM UTC

Hi @Velkumar @Rocko 

Thanks for the input.

 

After this  I m not able to see notification like Thing already exist or not in mashup.

Translate
19-Tanzanite
Mar 28, 2024 6:19 AM UTC

Hi @Pratik_Aswale  

 

Could you please post your implementation here. It will help us to understand issue better.

 

/VR

Translate