Skip to Content
author's profile photo Former Member
Former Member

SUPStorage api in SUP 2.1 to store array or structure


I am using below code to store key value pair using SUP api for offline storage in workflow apps:

SUPStorage.prototype.setItem(j, airlineId);

Example: var j = 1;

var airlineid = "lufthansa";

This works fine, but I want to store an array or at least a structure (single row) which has multiple items. How can we do that?

I tried passing MBO value data directly, but it gives exception while I try to read:

var mvc = getCurrentMessageValueCollection();
      var fData = mvc.getData("flightmbo"); 
      var values = fData.getValue();
     var i = 1;
     SUPStorage.prototype.setItem(i, values); 

This does not give any exception, but when I try to read by using code:

var  i = 1;

    airlineKey =  SUPStorage.prototype.key(i);

    values =  SUPStorage.prototype.getItem(airlineKey);

var j = 0;
   var theItems = values[j];

This gives exception saying "Type Error: Result of expression 'values' [null] is not an object".

Any workarounds to store a structure/array with the same key (such as airline id, text, time, availability).



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 09, 2011 at 12:16 AM

    Have you tried converting the array/structure to a string using JSON (or some similar technique) and storing it that way?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.