Forum Replies Created

Page 3 of 5
  • Uwe Smidt

    Member
    October 23, 2024 at 9:33 am in reply to: How to report spammers?

    I find the campaigns of spammers an absolute nuisance – here and in the resulting mails in my mail box – therefor I would really appreciate a more general approach…

    Maybe it would make sense to manually release the first post of a new member? So ANYONE can read, but only checked members can post?

    Best regards
    Uwe

  • 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

  • Uwe Smidt

    Member
    October 23, 2024 at 9:25 am in reply to: jsProgressBar Control – not really controlling progress…

    Hi Andreas,
    Thank you for your thoughts!

    As for Omnis being busy: Yes, that’s the logical explanation, but I thought that ‘alwaysenabled…’ was helping that. And it is not too busy to react to hitting the escape key, but too busy to register a click on the Stop button…

    And it was not to busy to register a click on the Stop button while I still had the progress bars in jsMains – so maybe the modal property of invoking jsProgressDialog with

    Do $cinst.$clientcommand('subformdialogshow',row('jsProgressDialog',lcParams,'Work in Progress',475,340))

    makes it even more busy…

    And yes, putting lengthy processes in the background so the user can continue working is the way to go! And yet, being able to control the lengthy process with the progress bars is just what they are meant for, aren’t they 😉

    However, installing an Omnis REST server to manage push messages seems to me like using a sledgehammer to crack a nut…

    But anyway, this ‘little’ problem brought me closer to understanding the asynchronicity of client methods and server methods, and what it implies…

    Thank you for your help along the way!

    Best regards
    Uwe

  • Uwe Smidt

    Member
    October 23, 2024 at 9:04 am in reply to: jsProgressBar Control – not really controlling progress…

    You’re welcome!
    I’m afraid I don’t even know how to convert it to 10.22.

    But your general solution might be to get an up-to-date community edition to look into libs newer than your Omnis version.

    Best regards

    Uwe

  • Uwe Smidt

    Member
    October 22, 2024 at 8:42 pm in reply to: jsProgressBar Control – not really controlling progress…

    The progress bar library – please feel free to use, comment or improve

  • Uwe Smidt

    Member
    October 22, 2024 at 8:40 pm in reply to: jsProgressBar Control – not really controlling progress…

    Allright….,
    I got it all set up, but what a pain to do such a seemingly simple task…

    The process is started and runs in jsMain, while the progress is being shown in the jsProgressDialog evoked by clientcommand…subformdialogshow.

    I can interrupt the process by hitting escape (via the form’s cancelkeyobject), but not by clicking the Stop-button, despite being the alwaysenabledobject. Is that a bug, or a feature?

    I enclose the lib in the next post, for anyone interested in my struggle… 😉

  • Uwe Smidt

    Member
    October 19, 2024 at 10:15 am in reply to: jsProgressBar Control – not really controlling progress…

    Dear Andreas,
    dear $all,

    I tried to adapt it to my needs, but what I want does not work since it is in a nested loop:

    method ‘$doAPIStuff’:

    For Loop1 from 1 to 10
    Do API call 'A'
    For Loop2 from 1 to 100
    Do API call 'B' ## using input from API call ''A'
    For Loop3 from 1 to 1000
    Do API call 'C' ## using input from API call ''B'
    Do Method $updateProgressWindow
    End For ##Loop3
    End For ##Loop2
    End For ##Loop1

    As I understand now, this Loop structure is unsuitable to update a client window. Is that right? Do I REALLY need to break up my ‘wonderful’ loop structure and let the iteration be handled by daisy-chaining ‘$doAPIStuff’ with ‘$updateProgressWindow’ and ‘$updateProgressWindow_return’, i.e. calling ‘$doAPIStuff’ not just once, but (here) 1 million times?

    Another question in this regard: I would like to start the action (the API calls) from a main form (rfMain) with, say with a button ‘doApiStuff’, but show the progress in a modal window ‘jsProgress’ called by subformdialogshow. While I can reference rfMain from rfProgress by $cinst.$container, how do I reference the subformdialog from rfMain?

    Thanks in advance

    Uwe

  • Uwe Smidt

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

    Hi Andreas,
    Yeah, I think this is hinting in the right direction.

    I’ll try to adapt it in my setting, and come back to this forum with my approach or new questions ;-)!

    Thank you!
    Uwe

  • Uwe Smidt

    Member
    October 9, 2024 at 3:22 pm in reply to: File upload/download

    Hi Obonye,

    it was ‘only’ 2.200 files, but I up- and downloaded them to/from Omnis with the FileOps-Object (https://www.omnis.net/developers/resources/onlinedocs/FunctionRef/Functions_A-Z/fileops-readfile.html#fileops.readfile):

    Maybe this helps!
    Regards
    Uwe

  • 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

Page 3 of 5