Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum bintobase64()

  • bintobase64()

    Posted by Dario L. on June 20, 2018 at 10:39 am

    Good morning,
    I can’t seem to find a way to get this recently introduced function to work properly.
    If I write down something like this:
    Do bintobase64(lBinVar) Returns lCharVar
    or
    Do bintobase64(“static string”) Returns lCharVar
    All I get is a conversion error (binary to char error, which is actually strange on its own since binary can be easily converted to a single char or string…)
    Can anyone please post a working example of usage for this function?
    Thank you in advance

    Dario L. replied 6 years ago 2 Members · 5 Replies
  • 5 Replies
  • Dario L.

    Member
    June 21, 2018 at 9:16 am

    Relevant info: i’m using OS 8.15

  • Henk Noppe

    Member
    July 3, 2018 at 9:22 am

    Hejhej Dario,
    How is the contents of lBinVar constructed? Has lBinVar the datatype binary?
    grtz Henk

  • Dario L.

    Member
    July 3, 2018 at 11:55 am

    Hi, thanks for your answer.
    Yes, lBinVar is a generic binary variable, whereas lCharVar is a character value (of proper length).
    What bugs me is that the bintobase64() function seems to always return a binary variable rather than a char(string). I think this is wrong since a conversion to base64 is supposed to return a string..
    So i thought that either I’m not using this function the correct way or the function is bugged/not properly documented. I’m currently forced to use the OXML object, which usage is not recommended for REST requests.
    I’m looking forward for an answer. Bye

  • Henk Noppe

    Member
    July 3, 2018 at 12:35 pm

    Hi Dario,
    I did some experimenting and came up with the following code:

    Calculate charValue as ‘Hello World’
    Do chartoutf8(charValue) Returns binValue
    Do bintobase64(binValue) Returns base64Bin
    Do utf8tochar(base64Bin) Returns base64value
    ; base64value will be SGVsbG8gV29ybGQ=

    I am not sure why you do not get a character out of the bintobase64 function. Would make more sense to me, but maybe one of the Omnis Software fellows who are lurking here (or anyone else) can shed some light on this topic…
    Grtz Henk

  • Dario L.

    Member
    July 3, 2018 at 2:48 pm

    Thank you.
    I couldn’t manage to come up with your solution and I think it is actually a good workaround, although not the best in terms of performance.
    I’ll keep experimenting with it, at least now i know how to put it to good use. 🙂
    Let’s hope we will receive an official statement regarding this function’s behavior and correct usage.
    For now, thank you again.
    Bye
    Dario

Log in to reply.