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

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

Best practice to handle large checklist (100+ input fields) — how to store and load efficiently?

MA8731174
16-Pearl

Best practice to handle large checklist (100+ input fields) — how to store and load efficiently?

Hi everyone,

I have a checklist mashup that consists of around 6 pages, each page containing a mix of text fields, checkboxes, and dropdowns — in total, roughly 100+ input widgets whose values need to be saved in the database.

My question is about best practices for handling this kind of large form in ThingWorx:

  • Should I bind every single widget value directly to a service input parameter and call a “save” service?

  • Or is there a better way to collect all values dynamically (for example, in JSON) and store them in one field (like metaData)?

Ideally, I would like to:

  1. Save all the entered values in the database as a JSON object (for flexibility and version tracking).

  2. Load the same data back into the mashup later, automatically populating all corresponding widgets.

What’s the most efficient and maintainable approach to achieve this in ThingWorx?
Would you recommend using MashupFunctions / Service calls / JavaScript / JSON encode-decode logic for this?

Any examples, tips, or performance considerations would be really appreciated.

 

Thanks in advance!
– Jamal

3 REPLIES 3

Hello Jamal,

 

You can have 101 expressions in your mashup: 100 x "jsonToXXX + 1 x "inputsToJson" (with 100 parameters). Then you bind everything through those expressions, and keep your server-side services accept / return a large JSON object. I wouldn't call it best practice, but it will achieve the flexibility that you are after.

 

You might be able to write an extension that iterates over mashup widgets in runtime, reads and sets values via GetProperty() / SetProperty(), but I've never done it myself, so don't know how easy or hard it is. Sounds doable.

 

If you really have 100 fields in a form, I would assume you are generating such mashups automatically, and then generating those expressions should not be hard. If you do it manually... well, you probably already hate this process, so multiplying it by three won't make any difference.

 

/ Constantine


Vilia (my company) | GitHub | LinkedIn

Hi @MA8731174 ,

How is a page from the checklist being displayed in a Mashup? Are you using tabs?

It seems to me that this is an application that tries to mirror a paper checklist into a ThingWorx mashup, and I believe in such situations should be reworked at the process level to be drastically simplified.

I'd say that having the serializing/deserializing logic done on the backend is probably the easiest in this case, as you can have 2 services (1 Get with an Infotable with 1 row and 100 columns, and 1 Save with 100 input parameters). The issue I have with such a large number of expressions is that it's going to be a lot of work to create them manually - while on the backend you can create easily programmatically a DataShape with 100 columns.It's just that backend seems to be slightly better at managing such a large number of parameters.

Hello Vladimir,

 

I would argue that a JSON approach is easier to maintain. If you need to add a new field:

  1. With DataShape appoach you'd need to:
    1. Add a new Save() service parameter
    2. Add a new field to the DataShape
    3. Add a new widget
    4. Add bindings from widget to Save() and from Get() to widget
  2. With JSON approach you'd need to:
    1. Add a new widget
    2. Create a new "jsonToXxx" Expression
    3. Add a parameter to "inputsToJson" expression
    4. Add bindings to / from widget to/from those expressions

So the amount of work is roughly equivalent, but I like the JSON approach more since all changes are confined to a single mashup entity.

 

That said, I agree that cramming 100 input fields in a single mashup is a bad idea. My original suggestion was to either delegate this to Excel 365, which they currently have, or to script that mashup generation based on some input schema.

 

@MA8731174 There's a third option you might want to explore -- make your form a bunch of key/value pairs and use Collection widget to display input widgets.

 

/ Constantine


Vilia (my company) | GitHub | LinkedIn
Announcements


Top Tags