0

Field Grouping Layout Element

This is a continuation of Peter's thread, which was apparently deleted with the purge of the spam posts. I am suggesting a new Layout Element that would use the HTML <fieldset> tag to group fields on the the Form page which appears to be rendered using HTML anyway. It could be implemented in a way similar to adding fields to a table. Here is a screen shot from the Mac app that shows what I'm talking about...

 

Screen Shot 2019-05-13 at 4.16.21 PM

 

The groups are just Formula fields in this case and use the html() function. The "Style" option has the "Background color" set to RGB 238, 238, 238. Here is the formula if anyone wants to try it out...

 

html("
<form>
<fieldset>
<legend>Group 1:</legend>
Text1:
<input type=""text"" name=""Text1"" value=""Testing 1"">
<br>
Text2:
<input type=""text"" name=""Text2"" value=""Testing 2"">
</fieldset>
</form>
")

 

Text6 and Text7 are Ninox Text fields and the Groups are formula fields using the html() function.

29replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Mconneen
    • Mconneen
    • 3 yrs ago
    • Reported - view

    @Sean.. +1.. 

    Like
  • +1

    Like
  • +1

    I actually like the way you have done it within a formula field. If Ninox could provide automatic data binding to the underlying table for html form fields within a formula field, that would open up lots of new possibilities.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    I really don't know what to say as an observer and user of Ninox. There are many requests that seemingly would be easy to implement given the model of the app, but they are ignored. In one of the few webinars I tuned into Alex mentioned they started using React... does that mean a complete rewrite? Of course there is the relatively new focus on No Code Low Code, but this request would seem to fit in that paradigm.

     

    At this point, if you use the html() function for anything other than displaying information it looks like you will need to create a parser to get the information out. Personally, I don't think that's any more difficult than using html if you are going that route, especially if you kept it very sparse. On that note, I wrote a data scraper using Ninox to create a forum database. I scraped the Technical Help section last night which took about 25 minutes per 1000 threads and most of that time was a result of the http calls. Scraping your own html in your database would be instantaneous.

    Like
  • Sean, can you provide a sample of data scraping our own html from within our database code? It sounds like an interesting approach.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Dean, I'll put something up as soon as I can. I mentioned in the other thread that it won't be seamless and by that I mean the user will have to click a button in the formula field with the html and then click a button on the Ninox form to submit it to the database. Will that still work for you?

    Like
  • Sean, Yes it still sounds good.

    Like
  • Sean, the following works and the "Get Value" button does not even need to be in the same formula field. Now I just need to know how to persist the values to Ninox fields.

    html("
    <form>
    <fieldset>
    <legend>Group 1:</legend>
    Text1:
    <input type='text' name='Text1' value='Testing 1' id='input1'>
    Text2:
    <input type='text' name='Text2' value='Testing 2' id='input2'>
    </fieldset>
    <button type='button' onclick='getInputValue();'>Get Value</button>
    <script>
    function getInputValue(){
      var value1 = document.getElementById('input1').value;
      var value2 = document.getElementById('input2').value;
      alert(value1 + '\n' + value2);
    }
    </script>
    </form>
    ")

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Dean, That's the bridge I was never able to find and why I think you'll need to scrape the information. I wanted to finish up my scraping project and then I'll try to create an example database.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    At this point I am unable to make it work. This is what I put in a Forumula field...

     

    html("
    <fieldset>
    <legend>Group 1:</legend>
    Text1:
    <input type='text' name='Text1' value='Testing 1' id='input1'>
    <p id='Text1'></p>
    Text2:
    <input type='text' name='Text2' value='Testing 2' id='input2'>
    <p id='Text2'></p>
    </fieldset>
    <button type='button' onclick='getInputValue();'>Get Value</button>
    <script>
    function getInputValue(){
    var value1 = document.getElementById('input1').value;
    var myObj1 = document.getElementById('input1');
    myObj1.remove();
    document.getElementById('Text1').innerHTML = value1;
    var value2 = document.getElementById('input2').value;
    var myObj2 = document.getElementById('input2');
    myObj2.remove();
    document.getElementById('Text2').innerHTML = value2;
    }
    </script>
    ")

     

    The changes are made in the field with the HTML, but the raw() function does not return the updated HTML. What I expected from the raw() function is the value between <p id='Text1'> and </p>. If that worked you could use the index() and substring() functions to parse the values and assign those to Ninox fields.

    Like
  • Sean, Thank you for trying.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Dean, Have you looked at the REST API? I have zero experience with it and I don't know if it will work inside the html() function. You might want to look into one of the API webinars.

    Like
  • Sean, I have assumed that the API approach would not work because anything executed from within a formula field would be seen as being outside of Ninox. I would prefer not to have to use a outside service like Integromat. I have nothing against Integromat, I just think the additional cost and reduction in speed would not be a good fit for this situation.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Dean, I haven't had any coffee yet and I shouldn't have said I have zero experience with it. I experimented with the examples using code in a button and copied the result to a Text field...

     

    let response := do as server
    http("POST", "https://api.ninox.com/v1/teams/NDKpJAeL7bWtZBncq/databases/c43myvb6qcoh/tables/B/record", {
    Authorization: "Bearer " + NK,
    'Content-Type': "application/json"
    }, {
    A: "Stewart & Stevenson"
    })
    end;
    if response.error then
    alert(text(response.error))
    else
    'Returned Record' := text(response.result)
    end

     

    If we're following the same approach with a formula field, you would have to use something like fetch() in javascript instead of http() in Ninox. I just learned a little about it last night after a long day so I don't much detail to offer. I don't think something like Integromat is necessary to access their API.

    Like
  • Sean, When you click the button, what do you see in the 'Returned Record' field?

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Screen Shot 2020-09-01 at 4.02.06 PM

    Other than parsing, I don't know how you extract the field information. There is probably a way though.

    Like
    • Mconneen
    • Mconneen
    • 1 yr ago
    • Reported - view

    @Sean,

    Rather then setting the 'Returned Record' to text... You can just set it to response.result.    It is now a json object.. So you can then reference the fields like..

    'Returned Record'.Name

    parseJSON(jsonString);

     

    This way.. if the third party changes their record structure .. but presumeably NOT the keys... I can keep going..

    On several of my integrations.. I store only the key fields... then the entire json object as text... I can then pull it back out of the table row using

    Like
    • Mconneen
    • Mconneen
    • 1 yr ago
    • Reported - view

    oops.... not sure how this got flipped around.... Here is what the post was SUPPOSED to look like..

    @Sean,

    Rather then setting the 'Returned Record' to text... You can just set it to response.result. It is now a json object.. So you can then reference the fields like..

    'Returned Record'.Name

    On several of my integrations.. I store only the key fields... then the entire json object as text... I can then pull it back out of the table row using

    parseJSON(jsonString);

     

    This way.. if the third party changes their record structure .. but presumeably NOT the keys... I can keep going..

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    @Mconneen, Thank you. I figured there was a better way and I'm afraid I have parsing on the brain right now. I really haven't spent any time with the REST API since this, https://ninox.com/en/forum/technical-help-5ab8fe445fe2b42b7dd39ee7/ninox-http-calls-syntax-5c83993071d2ba74f1399907. Dean's use case got me interested again.

     

    In the thread above part of the discussion was about queries. I saw in the updated documentation that filtering is available. Have you tried it yet?

    Like
  • Thank you Sean and Mconneen. This is now working every time:

     

    let response := do as server
    http("POST", "https://api.ninox.com/v1/teams/" + yourTeamKey + "/databases/" + yourDatabaseKey + "/tables/A/record", {
    Authorization: "Bearer " + yourAPIKey,
    'Content-Type': "application/json"
    }, {
      A: "Stewart & Stevenson"
    })
    end;
    if response.error then
      alert(text(response.error))
    else
      let obj := response.result;
    'Returned Record' := obj.fields.Name
    end

    Like
  • Hi Sean,

    When you have a solution with scraping i'm interessed.

    I dont know how can possible to pass value from  one context to another.

    Have y nice day.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Hi Robert,

     

    Whe you use the http() function to access a URL, you can get the HTML from the page. Then you have to find the items you want to save. This is what I use to get a forum page title...

     

    let htmlString := response;
    let startString := "<h3 class=""mt-16 mb-24"">";
    let endString := "</h3>";
    let startStringLen := length(startString);
    let substringStartPos := index(htmlString, startString) + startStringLen;
    let substringEndPos := substringStartPos + index(substr(htmlString, substringStartPos), endString);

     

    This is how I save it to the 'Thread Title' field...

     

    'Thread Title' := replaceHTMLEntitiesAndTags(substring(htmlString, substringStartPos, substringEndPos))

    Like
  • Hi Sean, ok i know and understand your way for retrieve the data. But my problem is how can scrap data from a formula fields where i use html().

    E.g. i have a html code, where it show a basic text field. i use formula field : html(my code for my html text field). Now if i insert : my name to the field i want scrap the value in a variable in the ninox.

    i turn arrond this from many days(month), but i cant grap the value. Why? Because ninox evaluate my code whit her function html() then if i raw() my html its is always the base code html, and not with my value inside.

    Any idea?

    Best Regards

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Robert, please reread page 2 of this thread.

    Like
  • yes a read, and it's not possible!

    Like
Like Follow
  • 1 yr agoLast active
  • 29Replies
  • 3752Views