cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Invoke service of parent mashup on Data changed event of textfield from child mashup

VK_10159720
8-Gravel

Invoke service of parent mashup on Data changed event of textfield from child mashup

Hi Developers,

 

I have a parent mashup which has a collection widget. On collection widget, I have a textfield widget.

Requirement is to refresh another service on parent mashup whenever a user enters value in the textfield widget. This service is used as input to second collection widget on same parent and we need to refresh values on second collection widget.

Issue is that use of global parameter or session parameters are not allowed in our organisation.

Kindly suggest some expression or way to achieve this.

 

Thanks in Advance.

4 REPLIES 4

Hi @VK_10159720 ,

 

I did a workaround for the same kind of scenario in my project. It may helps you. 

 

Step 1: Create a Expression with Randon Number Generation in Collection's Child Mashup it should execute on TextBox Values Changed Event and Pass the expression output to 1 Number basetype Mashup Parameter (MP_RandonNumber)

Arun_C_0-1701866737234.png

 

Step 2:  In Collection Widget eidt & update the MashupGlobalPropertyBinding property with created child mashup parameter name which carrying the randon number from child mashup & its basetype.

 

Arun_C_1-1701867082531.png

 

Step 3: Create a auto evaluvate Expression in Parent Mashup to print the data of randon number from collection (ex : Output = MP_RandonNumber).

Arun_C_2-1701867340804.png

 

Step 4: Based on the Expression Changed event you can execute the service from Parent Mashup.

 

I have attached the demo entities FYR - Import Datashape, Thing & Mashups. Kindly let me know if any queries. Also commuity please let me know if any easy way there to achieve it.

 

Note: This will works based all cells textbox values changed.

 

Thanks & Regards,

Arun C

 

 

 

 

 

 

@VK_10159720 ,

 

Without using session parameters,  I imagine that's going to be a bit tricky.  I did some testing on a ThingWorx 9.0 expression and it does appear that you have access to the local storage api:

localStorage.setItem("testing","123");

 

However, you wouldn't get any ThingWorx event from that and I'm not sure your organization would allow that either.  The server side option would have to include Things or Data Tables that store that value and perhaps update some property on a session or user-specific thing.  Then you can use the web-socket feature of getProperties to immediately know when that property has been updated... but that's a lot of complexity in my opinion 

 

- Nick

Rocko
17-Peridot
(To:VK_10159720)

Similar to nmilleson's reply;

Either move that textbox out of the collection or when you enter a value, have that call a service which updates a things property. On the parent mashup, use getProperties to actively monitor/push that value change to the execution of the second service.

wcui
14-Alexandrite
(To:VK_10159720)

@VK_10159720 can you check Rocko's response ? if the solution is good for you, please mark it as "accepted solution". Thanks.

Top Tags