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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

What are the various idea to store temporary data/cache

AP_10343008
13-Aquamarine

What are the various idea to store temporary data/cache

I stored infotable data in userextensions which will be moved to datatable once user clicked submit button. 

But updating one infotable userextension property for frequent service execution causing loss of data. 

Any other possible ways are there to store infotable values temporarily?

8 REPLIES 8
Rocko
17-Peridot
(To:AP_10343008)

As of 9.5.1 you could try to use

TW.sessionStorage.getItem()
TW.sessionStorage.setItem()
 
 
AP_10343008
13-Aquamarine
(To:Rocko)

It is working in expression of mashup. But how to execute this from Things>>Services ?

Rocko
17-Peridot
(To:AP_10343008)

If you need this server side, you can think about transient properties (not persistent, not logged), and you could create your own UserSessionThing which holds those properties, tied to the User and their current session.

mstarnaud
13-Aquamarine
(To:AP_10343008)

Hi AP

 

Have you considered using a DataTable entity?

 

In Composer, you can create a DataTable by associating in to a specific DataShape. In Composer it gives you a UI ("Mashup" tab) to view & modify the data without needing to create a custom Mashup. It also comes with pre-made services, like QueryDataTableEntries and AddDataTableEntry to view and modify the data, you could use those services in a custom Mashup.

 

If you need to separate them by user, you could their default "Source" column, or add a custom User column to the DataShape, or even create a separate entity for each user.

AP_10343008
13-Aquamarine
(To:mstarnaud)

Ofcourse it is user specific data. 
Will it work even if n number of users updating at same time?

mstarnaud
13-Aquamarine
(To:AP_10343008)

As I said, you do have the possibility of creating a different entity for each user. For example TempDataTable_mstarnaud, TempDataTable_AP103343008, TempDataTable_Rocko. You could even manage their permissions so only the related user has access.

 

I'm not an expert on DataTables. But if you're using 1 DataTable shared to everyone, I do think you would have the risk that 2 people may try to modify the same record and one user's changes would override the other user's changes. For example if both users look at the same record, then user #1 deletes the record, and user #2 then tries to update it I'm expecting the update will fail. Which is why in your case using 1 shared DataTable and the default Composer UI may not be the best idea, I would suggest either separating it (1 DataTable per user) and/or making a Mashup that only gets the current user's records.

Rocko
17-Peridot
(To:mstarnaud)

Two comments on this:

1) in OP they stated data "will be moved to datatable once user clicked submit button" so my understanding is that there already exists a datatable. Not sure if additional Datatables would help in the situation, also as it seems to be temporary data.

2) Datatables per default have a user column which is populated automatically and can be used to filter to avoid data of other users being exposed.

I'm not sure if I understand your question.
Do you have user A using his PC, user B using this same app at different PC? And you want store datas of user A to be storing his own data in such way, it does not influence user B, and vice-versa? So, if user A stores his data, THEN user B store his - it does not overwrite user A data?
Sounds like session info/session parameters. Here you have docu for it: Session Parameters (ptc.com).
But I'm just testing it so can not confirm if it works well. 

Top Tags