cancel
Showing results for 
Search instead for 
Did you mean: 

SUPStorage api in SUP 2.1 to store array or structure

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

david_brandow
Contributor
0 Kudos

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