Forum Replies Created

Page 4 of 6
  • Uwe Smidt

    Member
    September 13, 2024 at 3:08 pm in reply to: REST API Client – POST file

    I have the feeling that it has to do with the way I construct the body:

    
    

    Calculate iContentChar as con('data:image/png;base64,',lcFileBase64)

    I tried

    Calculate iContentChar as con('data:multipart/form-data;base64,',lcFileBase64)

    because of

    Do iHeadersList.$add("Content-Type","multipart/form-data")

  • Uwe Smidt

    Member
    September 13, 2024 at 2:51 pm in reply to: REST API Client – POST file

    Hi Andreas,
    Thanx for your prompt response!

    I use Postman to test API calls, and while it has a nice GUI to put things together, it also ‘translates’ into various other languages, e.g. the actual HTTP message:

    POST /v1/teams/EjnXhyYwG2hZYxX6A/databases/tz8mz96j4nt0/tables/A/records/1/files HTTP/1.1

    Host: api.ninox.com

    Authorization: Bearer 3288b990-703a-11ef-9b57-290f46ee5e30

    Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

    Content-Length: 184

    ------WebKitFormBoundary7MA4YWxkTrZu0gW

    Content-Disposition: form-data; name="Robby3"; filename="Robby3.jpg"

    Content-Type: image/jpeg

    (data)

    ------WebKitFormBoundary7MA4YWxkTrZu0gW--

    And yes, there is a Header ‘Content-Length’, but I have no clue as to what length to measure (and 184 (bytes?) for a 4.3 MB file seems a bit misleading…

  • Uwe Smidt

    Member
    July 19, 2024 at 5:01 am in reply to: Renaming objects – missing prompt for search and replace

    Hi Andreas,
    then I’m not surprised that I could not find the setting…🤪
    Thanks anyway!

    Best regards
    Uwe

  • Yeah! iconurl() did the job – now they are all visible again!
    But I’ll see into the other option, too – sounds interesting!

    Thank you very much for your help!

  • Thank you for your responses, I’ll give it a go!

  • Uwe Smidt

    Member
    July 6, 2024 at 10:11 am in reply to: Contribution to the community Comment

    Ola Diego,
    como estas?

    This is about all I can say in Spanish, so it’s great that we can meet in the middle, by writing in English – as good as we can 😉

    Thank you very much for your contribution, it is really appreciated, even if some of it is written in Spanish. It is still better to post it, than to keep it to yourself because it is a lot of work to rewrite it into English. I do a most of my #commenting and object naming in German, so I understand the problem here…

    But if someone finds the libraries / problems addressed interesting, there will be a way to overcome language barriers.

    Actually, it is not so much the aspect of not wanting to share my code/knowledge (it’s no big deal anyway), but much rather the work of extracting something special into something general that can be used without much explanation.

    But maybe your post will be the starting point of more people sharing interesting code snippets or complete libraries.

    Best regards

    Uwe

  • Uwe Smidt

    Member
    January 6, 2024 at 12:02 pm in reply to: Positioning Studio/IDE windows by code

    Dear $all,

    when trying to implement an automation of ‘switching between Omnis.cfg files per environment’, I came across an old Zombie🧟‍♂️: AppleScript! And Omnis does still support it, e.g. moving windows around. Below are some lines of code that do the job. Now I only needed the script to be executed with a keyboard shortcut – for which I found no working built-in solution.

    So I came across a utility called ‘Keyboard Maestro’ which did the rest: triggering the macro with a keyboard shortcut, and then calling the script ‘mobile’ if only one screen is present, or calling ‘Desktop’ if an external screen is present, too. Eh voila – I’ve got all my windows sorted nicely 😊!

    set vtop to 25
    set vleft to 0
    set vright to 3008
    set vbottom to 1692
    set vBottomRowTop to 1390
    set vOffset to 30
    set vStackForms to 0
    set vStackMethods to 0
    tell application "Omnis Studio 11 35659"
    set WinList to name of windows
    --display dialog WinList
    repeat with currentWindow in WinList
    set currentBounds to bounds of window currentWindow
    --display dialog currentWindow & ": " & currentBounds
    if currentWindow contains "Studio Browser" then
    set bounds of window currentWindow to {vleft, vtop, 1000, 800}
    else if (currentWindow begins with "rf" and currentWindow contains "methods") or (currentWindow begins with "ta") or (currentWindow begins with "tv") then
    -- Remote Form Methods, Table Class methods
    set bounds of window currentWindow to {1360 + vStackMethods, vtop + vStackMethods, 2360 + vStackMethods, 800 + vStackMethods}
    set vStackMethods to vStackMethods + vOffset
    else if currentWindow begins with "rf" and currentWindow contains "Grid" then # Remote Form
    set bounds of window currentWindow to {300 + vStackForms, vtop + vStackForms, 1200 + vStackForms, 450 + vStackForms}
    set vStackForms to vStackForms + vOffset
    else if currentWindow begins with "rf" then # Remote Form
    set bounds of window currentWindow to {300 + vStackForms, vtop + vStackForms, 1200 + vStackForms, 700 + vStackForms}
    set vStackForms to vStackForms + vOffset
    else if currentWindow contains "Component Store" then
    set bounds of window currentWindow to {vleft, 900, 199, vBottomRowTop - 1}
    else if currentWindow begins with "Field List" then
    set bounds of window currentWindow to {200, 900, 1100, vBottomRowTop - 1}
    else if currentWindow contains "Property Manager" then
    set bounds of window currentWindow to {2620, vtop, vright, 1014}
    else if currentWindow begins with "Catalog" then
    set bounds of window currentWindow to {2620, 1015, vright, vbottom}
    else if currentWindow contains "ucConstants" then
    set bounds of window currentWindow to {vleft, vBottomRowTop, 799, vbottom}
    else if currentWindow contains "Notation Inspector" then
    set bounds of window currentWindow to {800, vBottomRowTop, 1139, vbottom}
    else if currentWindow contains "Inheritance Tree" then
    set bounds of window currentWindow to {1140, vBottomRowTop, 1480, vbottom}
    end if
    end repeat
    end tell


  • Uwe Smidt

    Member
    December 21, 2023 at 1:27 pm in reply to: $makelist WITH column names / maxc() WITHOUT column names

    getting the maximum value of the the items in Col6 of the list

    (which I did get with with maxc(myList,myCol)).

    But I thought that myList.Col6.$maximum() would do the job without having a column name

  • Uwe Smidt

    Member
    October 9, 2024 at 3:03 pm in reply to: jsProgressBar Control – not really controlling progress…

    Dear Diego,
    Thank you for your reply!

  • Uwe Smidt

    Member
    September 15, 2024 at 10:45 pm in reply to: REST API Client – POST file

    I got it! I got it! 🤩🤩
    It took some RTFM, and before that, some detective work…

    I think on the lists.omnis-dev.com I read that you can turn on logging. My knowledge of the OW3 HTTP worker came the online docs: Extending Omnis – Chapter 1: Web services – I wasn’t aware that there was a much more detailed help in Chapter 7 – OW3 worker objects. And there, I did not only find out how to turn on logging, but more importantly the method $multipartaddfile.

    Now it only took some trial & error, but here is the code that works:

    Calculate iHTTPMethod as kOW3httpMethodPost

    Do iHeadersList.$clear()

    Do iHeadersList.$add("Authorization","Bearer 3288b990-703a-11ef-9b57-290f46ee5e30")

    Do iHeadersList.$add("Content-Type","multipart/form-data")

    Calculate iURI as con("https://api.ninox.com/v1/teams/EjnXhyYwG2hZYxX6A/databases/tz8mz96j4nt0/tables/A/records/1/files")

    Do loFileOps.$openfile('/Users/usmidt/Desktop/300_5369.jpg')

    Do loFileOps.$readfile(lbinContent)

    Do loFileOps.$closefile()

    #Do llPartHeaders.$define(lcPartHeaderName,lcPartHeaderValue) ## does not seem necessary

    #Do llPartHeaders.$add('Content-Type','image/jpg') ## does not seem necessary

    Do iRestfulObj.$protocollog.$assign(kOW3logBasic+kOW3logData)

    Do iRestfulObj.$multipartaddfile('300_5369',lbinContent,'300_5369.jpg') ## ,llPartHeaders) does not seem necessary

    Do iRestfulObj.$init(iURI,iHTTPMethod,iHeadersList,kOW3httpMultiPartFormData) Returns lStatus

    Do iRestfulObj.$run() Returns lStatus

    This may only be a small step for mankind, but it’s a giant leap for me😃!

    Thanks so much for everyone who helped me along the way!

  • Uwe Smidt

    Member
    September 14, 2024 at 9:34 am in reply to: Picture upload via API

    Dear Paul,
    dear $all,

    I have a similar problem with the REST API – maybe you have an idea on how to solve it:
    https://www.omnis.net/community/forums/forum/discussion/rest-api-client-post-file/

  • Uwe Smidt

    Member
    September 13, 2024 at 3:00 pm in reply to: REST API Client – POST file

    Did it, but still ‘Internal Server error’..

    Calculate lcFileBase64 as utf8tochar(bintobase64(lbinContent))

    Calculate iContentChar as con('data:image/png;base64,',lcFileBase64)

    Do iHeadersList.$add("Content-Length",len(iContentChar))

    Do iRestfulObj.$init(iURI,iHTTPMethod,iHeadersList,iContentChar) Returns lStatus

  • Uwe Smidt

    Member
    January 2, 2024 at 2:35 pm in reply to: Positioning Studio/IDE windows by code

    Dear Andreas,

    Thanks for your response!

    Ironically, the Browser window is alway in the right place, but the Property and the Catalog window are the ones most needed and always in the wrong place 😉

    But at least I now understand why I don’t ‘see’ them in Omnis Notation Inspector…

    Regards

    Uwe

  • Uwe Smidt

    Member
    January 2, 2024 at 2:27 pm in reply to: Positioning Studio/IDE windows by code

    Dear Andreas,

    Happy New Year to you!

    Yes, this might be a workable workaround.

    But then I’d have to manage double pref files as config.json, omnis.cfg, sql.df1, query.df1.

    <font face=”inherit”>Do you know in which file the last environment is stored in? So I might just exchange that file via script, instead of doubling </font>the<font face=”inherit”> whole Studio installation.</font>

    Thank you!

    Regards

    Uwe

  • Uwe Smidt

    Member
    December 21, 2023 at 11:42 am in reply to: $makelist WITH column names / maxc() WITHOUT column names

    Thanx a lot Andreas!

    Both ways work fine!

    But why did this not work:

    # alternatively, try this
    Calculate liFormOldWidth as llFormObjectsOrig.Col6.$maximum()
    # is null

Page 4 of 6