Jump to content

Storing long strings in PIO objects


Recommended Posts

The last time I tried it was 32767, something to do with Int types or LongInt, I can't remember.

I've in the past used a splitter command and had 3 params set aside for storing data eg (storeParam1, storeParam2).

 

code below is an example of how it would go

# Split every_length x characters
def value_splitter(listparams:list, value_to_store):
    """
    listparams is List of record/plugin | field/parameter names
    """
    val_str = str(value_to_store)
    max_char_length = 32767
    val_params = [val_str[i: i + max_char_length] for i in range(0, len(val_str), max_char_length)]
    
    if len(val_params) <= len(listparams):
        for i, x in enumerate(listparams):
            vs.SetRField(plugin_handle, record, x, val_params[i])
    
    else:
        raise ValueError("Number of parameters too few for splitter")

 

 

A while back, VW introduced the use of ObjectUUIDs. You could try storing these in a json file together with the rest of the other data you're wanting to store.

 

Edited by twk
Link to comment
17 hours ago, twk said:

The last time I tried it was 32767, something to do with Int types or LongInt, I can't remember.

I've in the past used a splitter command and had 3 params set aside for storing data eg (storeParam1, storeParam2).

 

code below is an example of how it would go

# Split every_length x characters
def value_splitter(listparams:list, value_to_store):
    """
    listparams is List of record/plugin | field/parameter names
    """
    val_str = str(value_to_store)
    max_char_length = 32767
    val_params = [val_str[i: i + max_char_length] for i in range(0, len(val_str), max_char_length)]
    
    if len(val_params) <= len(listparams):
        for i, x in enumerate(listparams):
            vs.SetRField(plugin_handle, record, x, val_params[i])
    
    else:
        raise ValueError("Number of parameters too few for splitter")

 

 

A while back, VW introduced the use of ObjectUUIDs. You could try storing these in a json file together with the rest of the other data you're wanting to store.

 

 

ill have to give this a try. ideally i want to store it in a json format in the field. i think i could be fine with 32767 characters. i could also have it delete older data as it fills up. ill report back with what i come up with. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...