How can I decode a "BYTES" value from the "ACT_GE_BYTEARRAY" table of default H2 database?

Hi there,

I 've created a process variable of type json via camForm function and I would like to read its value (like I do in Cockpit) in the ACT_GE_BYTEARRAY table of default H2 database.

The issue is that the values there are stored as BYTES and so they aren’t readable by a human.

Does anyone know please if and how can I decode them so as to being human-readable?

Thanks in advance,
Steve

1 Like

You can use the UTF8TOSTRING function.

Hi @apinske and thanks for your feedback.

Could you please give me here an example of how and where I call this function?
Because, I have no idea on this.

Thanks,
Steve

to select all rows in human readable form use:
SELECT UTF8TOSTRING(BYTES_) FROM ACT_GE_BYTEARRAY

2 Likes

Hi again @apinske and thanks for your new feedback.

For some reason, all of my JSON Array variables are displayed 3 times (each one) in the ACT_GE_BYTEARRAY Table.

Do you know why does this happen? :thinking:

Steve

Thats hard to say without knowing your setup. You probably have history level set to full and the “duplicates” come from hi_varinst. Just check where the respective bytearray_id is referenced. Usual suspects are ACT_RU_VARIABLE, ACT_HI_VARINST, ACT_HI_DETAIL, ACT_HI_DEC_IN, ACT_HI_DEC_OUT.

Hi @apinske.

If I correctly understood what you mean, I made a search inside your suggested Tables and I wrote the following IDs:

First of all, my created JSON Array variable is displayed with 3 different IDs in the ACT_GE_BYTEARRAY Table:

  1. 949c4a9f-f58b-11e8-9208-bc7737358152
  2. 94c02652-f58b-11e8-9208-bc7737358152
  3. 94d7f414-f58b-11e8-9208-bc7737358152

And in the other Tables the same variable is displayed with the following IDs:

ACT_RU_VARIABLE : 94b85e20-f58b-11e8-9208-bc7737358152
ACT_HI_DETAIL : 94c02653-f58b-11e8-9208-bc7737358152

I didn’t find this variable somewhere else as far as your suggested Tables is concerned.

Can I deduce something from this search?

Thanks,
Steve

I don’t think there is any problem there.
You should usually search the other way round, i.e. get the variable (of the execution/…) you are interested in, then look in the referenced byte array. If you don’t want to understand the internal data structures - which you need not - it might be easier to use the REST API to explore your instances.

@apinske, when you say “look in the referenced byte array”, you mean in the “BYTES_” column for the JSON Array variable ?

And how could I explore my instances via REST API, could you please give me a simple example if it’s easy ?

Thanks,
Steve

Please refer to the docs for that, they are great.
https://docs.camunda.org/manual/7.10/reference/rest/

2 Likes

Hello, I need to do it using POSTGRES. Do you know how to?