Hi
New to the forum and Switch so forgive me if this is a stupid question.
I am trying to access from a script an SQL db column that is a type 'uniqueidentifier'.
The intention is to write it as privatedata for use later in the flow.
While SwitchScripter returns a value (although the text encoding looks wrong) Switch itself hangs and requires a restart.
Is there a way to deal with this data type within Switch or is it better to try a different approach?
Thanks for any advice
James
Database uniqueidentifier column
Re: Database uniqueidentifier column
Read the scripting documentation Scripting reference - Database module - Text encoding.
I have not tried but I would think that you will have to use getBinary for the uniqueidentifier type. As you can see in the documentation the return value of getBinary is a ByteArray object. You will have to convert that to a string in order to be able to add it to private data.
I have not tried but I would think that you will have to use getBinary for the uniqueidentifier type. As you can see in the documentation the return value of getBinary is a ByteArray object. You will have to convert that to a string in order to be able to add it to private data.
Re: Database uniqueidentifier column
Hi
Thanks freddyp
Yes your spot on just did a check and this is BINARY.
I assume it should be possible to read and convert as suggested.
However I have a second table that uses the same field that I need to access.
Is it likely I will be able to use the (now String) Private data created to search or am I wasting my time because of the Data Type conversion?
Thanks freddyp

Yes your spot on just did a check and this is BINARY.
I assume it should be possible to read and convert as suggested.
However I have a second table that uses the same field that I need to access.
Is it likely I will be able to use the (now String) Private data created to search or am I wasting my time because of the Data Type conversion?
Re: Database uniqueidentifier column
No, you are not wasting your time. You can create a ByteArray object from a string:
You may have to experiment a bit with the text encoding, eg:
More on this in the documentation on ByteArray and text encoding.
Code: Select all
var bin = new ByteArray(stringFromPrivateData);
Code: Select all
var bin = new ByteArray(stringFromPrivateData,"UTF-8");