Skip to Content
0
Former Member
Dec 01, 2011 at 04:33 PM

SUPStorage api in SUP 2.1 to store array or structure

36 Views

Hi,

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).

Thanks,

Rohit