0

disappearing formulas

I have just started testing the trial, which means web based and not the app. So far I have 2 tables, a parent and a child.

Currently driving me nuts is that in the list view of the child table I add a formula to display the name of the parent and I ok the dialogs to get back to the list and the formula column has been thrown away. I initially thought it annoyingly did this if I got the formula wrong and if I then add the column with a very simple formula instead (e.g. just display a single column) it works. I can see it and adjust the width etc. Click on the record and back and the formula column is still there. I then edit the formula to exactly what I wanted in the first place but was always discarded and it now works perfectly as it should. So the formula was actually correct after all.

Why this merrygoround whenever I want to add a formula column? It gets worse.

Having successfully added such a formula column in 'admin' mode, I then exit admin mode so it should all be saved. But the next time anthing is edited in 'admin' mode (or maybe just when I blink), the formula column is again discarded.

This is unsurprisingly driving me nuts. I've worked out what I need to do, but Ninox seems to block every attempt to do it, unless I take a circuitous route to avoid it being discarded. Then, it summarily discards it all anyway.

Is there something I am not understanding about how this is supposed to work? Seems unlikely as I am eventually able to get it to do exactly as I want. So why is it throwing stuff away?

Is this some limitation of 'trial mode' that is preventing me from actually being able to properly test it? I can sort of understand that, BUT I EXPECT TO BE TOLD THIS rather than wasting all my time trying to figure it out.

Over to you Ninox - or do they not bother to follow their own support forum? Needless to say, I'd appreciate it if anyone could explain this.

15 replies

null
    • UKenGB
    • 2 yrs ago
    • Reported - view

    More specifically, a formula field with a 2 line formula (set a variable and use that to get the desired data) will be discarded and not added to the table list view. Instead, use a simple formula like a single column and it IS added and switching between 'admin' mode and back or viewing a different table does not discard the formula column.

     

    Change the simple formula to the 2 line one that is actually required and the table displays as it should (so this change does not cause it to be discarded). However, if I now simply view a different table and then return, the forumla column has been discarded.

     

    ????

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    To keep the edits of columns you have to be in administrative mode. (Red wrench)

    Steven

    • UKenGB
    • 2 yrs ago
    • Reported - view

    I did state (clearly I thought) that I WAS in 'admin' mode and had exited that to be sure the configuration was then saved. Made no difference.

     

    That also does not explain why when trying to add the formula column (a formula with no errors and that later works perfectly) the last OK of the dialogs would then return me to the list but the column had NOT been added. No matter how many times I tried, 'admin' mode or not, the column would not be added and all work wasted. Do it again with a simple formula would work and then I could change it to the actual required formula which would stick. Until I viewed a different table and on return the formula column was gone. This occured on both tables.

     

    This is nothing to do with not being in 'admin' mode. I am well aware of the importance of that. But that's not it.

     

    Yesterday the formula columns (1 in each table) managed to last a little longer. This morning still showing in the displayed table (there'd been no redraw), but switch to other table and formula column is gone. Likewise switch tables and hey, formula column is gone.

     

    So, is this a trial limitation, that formula columns won't save even in admin mode, or is this a bug in the web version? No idea if also a bug in the app version as there's no trial for that.

    • Fred
    • 2 yrs ago
    • Reported - view

    Are you pulling data from another table that is not a child of the current table? Can the other table have a N:N relationship to the current table, even if you only have data that is 1:N?

     

    What is the formula you are using?

     

    To fix it you need to put either first or last around your formula. Or you can use any other function like sum, concat, etc.

     

    This is a big bug in Ninox. It doesn't warn you that it will not show the column because it can't figure out what to do.

    • UKenGB
    • 2 yrs ago
    • Reported - view

    No, the relationship is 1:N (in the right direction), but the crucial point is that I cannot add the column containing the actual required formula, but have to add it via a simpler formular which works and then I can edit to the required formula which works perfectly as it should. So the formula is 100% correct. It works and displays the exactly correct data from the parent table, for each row. From which we can deduce the formula IS correct.

     

    However, view a different table and on return, that column has disappeard from the list.

     

    As I'm only just starting to test Ninox, I could easily believe I am doing something wrong, but the only way configuration is lost should be if not in 'admin' mode at the time (whcih I have repeatedly ensured I am and then exited to save the config) and also that it refuses to add a column that I am indeed able to create via a more convoluted process and which then works perfectly, which rather suggests that there's nothing wrong with the formula.

     

    Let's be honest here, if software refuses to do something it is supposed to do and which does actually work, it pretty much HAS to be a bug. If that same software decides of its own accord to throw away part of a working configuration, that also has to be a bug. Unless anyone can shed any light on what arcane payers I need to conduct to make Ninox behave.

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Can you let us see this formula? It my well be something quite simple that is going wrong.

     

    Thanks John

    • Fred
    • 2 yrs ago
    • Reported - view

    Unless it is a child table, then Ninox considers any table relationship to be N:N. Like I said eariler, while your data might be 1:N, it could change so Ninox always treats related tables as N:N. I have a table called Partners which tracks Riders and Horses. It is setup to only have data for 1 rider to many horses, but there is nothing keeping from having a many to many relationship. So I have to use first, last, etc.

     

    for loop1 in select Results do
    if loop1.Partners = null then
    loop1.(
    let xRider := Riders;
    let xHorse := Horses;
    Partners := first(select Partners where Riders = xRider and Horse = xHorse)
    )
    end
    end

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Is that correct Fred? I thought all the relationshipes were 1:N

     

    Regards John

    • UKenGB
    • 2 yrs ago
    • Reported - view

    Any relationship between 2 tables is by definition 1:N (or N:1). The foreign key column in a child table can ONLY store the primary key of one single parent table record. The only way to obtain N:N is to use a third table to link the other tables. That could then be wastefully used as 1:N (N:1) if desired, but its real function is to provide a N:N relationship. A simple relationship between 2 tables can never be N:N and Ninox cannot consider it to be so.

     

    Of course multiple foreign keys could be used, but that requires modification of the schema to change the value of N and that is unacceptable as a database practice. The actual value of N should be determined solely by the data.

     

    As far as I can see, Ninox does treat 1:N correctly and the linked columns can be seen. So I'm not sure what Fred means by saying Ninox treats every parent/child relationship as N:N as that is impossible with just 2 tables.

     

    With regard to the problem I am experiencing, I am currently discussing this support as Ninox is doing something wrong.

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Notion treats all its relationships as N:N. Do you want to show the problem formula?

    • Fred
    • 2 yrs ago
    • Reported - view

    I stand corrected. My brain is bit muddled today.

    • UKenGB
    • 2 yrs ago
    • Reported - view

    The formula I was using is:-

    let marqueid := marques;
    (select marques where Id=marqueid).name;

    This was in the list view of the 'models' table, a child of the 'marques' parent table. When (in 'admin' mode) adding a Formula column to the 'models' list view the above formula showed NO errors, but on clicking all the 'OK' buttons to return to the data/list view, the column had not been added and returning to 'Edit fields' showed it was just not there. So it was as if I had clicked 'Cancel' instead.

    However, if I used e.g.:-

    let marqueid := marques;
    marqueid;

    This column would be added and I could see the correct Id number of the 'marques' record associated with each of the 'models' rows.

    I was then able to edit the formula to what I originally wanted and 'marques.name' was now displayed in that column of the 'models' table list view.

    This HAS to be some sort of Ninox error as at one time it refuses to utilise the entered formula, then by a different route I am able to use that same exact formula and it works perfectly. The only conclusion is that there is some programmatic error in Ninox, aka a bug.

    Then, having exited 'admin' mode, that view should be saved, but if I switch to a different screen (e.g. a different table) and back, that Formula column had vanished. So again, barring some sort of 'trial' mode restriction (which apparently there is not) there is no way that Ninox should simply delete a column that was actually functioning perfectly. There is something screwed up in Ninox's logic here. I suspect it is sometimes mistakenly thinking that the query is returning multiple rows, which it is not as I know the data (only testing with half a dozen rows at present so easy to ensure it is correct) and clearly it is NOT returning any array since it was working perfectly as intended before changing screens.

     

    So that is what is occuring, but I have now avoided the problem once I realised I could add the 'marques.name' column directly to the list view jsut by dragging it in the view's 'edit fields' screen. I had not originally noticed I could expand the parent table and simply drag the required field into place, just like any other field of the child table. So my lack of Ninox experience showing there - now I know better. However, my journey to the correct solution has exposed what has to be a Ninox bug as if an application can perform a function perfectly, it must perform that same function perfectly EVERY time and not behave in a different manner at different times. That is poor programming code and is of course, a bug.

     

    I am not trying to have a go at Ninox as I am pleased with how it is working so far, but it is not perfect. 

    • Alain_Fontaine
    • 2 yrs ago
    • Reported - view

    The first lesson from this thread is that, before resorting to the almighty "select" function, one should always check if the desired result cannot be obtained by perusing the existing relations in the database. The solution is then much simpler, and also enjoys an incredibly better performance.

    To illustrate this, I have made a simple database with two tables, where "Table2" contains a N:1 reference to "Table1". I populated this database with 1000 records in "Table1", and then created, in "Table2", 20 records related to each record in "Table1", for a total of 20 000 records. I wrote two scripts that, for each record of "Table1", scan the 20 related records of "Table2", and report the elapsed time. One procedure follows the references to find the related records, and the other one uses the "select" statement. Here are the results (iPad Air 2): 

    Done: 20000 records in 0:00:00.016.

    Done: 20000 records in 0:00:33.073.

    Guess wich one uses the relations…

    Another lesson is that the "select" statement *always* returns an array. Of course, if you use it as an inefficient way to find the parent record in an N:1 relation, this array will always contain one record, but it is still an array. And Ninox refuses to display arrays as column formulas. One could of course argue that it should give a warning, instead of silently discarding the column definition. If you replace your function by:

    let marqueid := marques;
    first((select marques where Id = marqueid).name)

    the result is not an array anymore, the function is accepted and its result is displayed.

    If you want to be convinced that an array is indeed returned, define a formula field in the "models" table as follows:

    let marqueid := marques;
    debugValueInfo((select marques where Id = marqueid).name)

    • UKenGB
    • 2 yrs ago
    • Reported - view

    Interesting Alain that you say Ninox "'select' statement *always* returns an array". it does explain some problems I've been seeing and initially cured with the use of e.g. first(), but…

     

    This is not standard SQL behaviour. When 'selecting' a single row, e.g. by its id, true SQL should only return a single item and it is up to the 'user' to ensure the validity of what they are trying to do. I suspect Ninox is trying to avoid ambiguity in the name of simplicity - mistakenly in my opinion.

     

    Also, the above code does actually work when first used and Ninox happily displays the Formula column using 'select' with no first(). Correctly for every row. It makes no mistake on this, apparently satisfied only one item is being returned. However, simply changing screens and back causes it to throw away the entire column for the reason I ascertained and as you have confirmed, it thinks an array is being returned. No matter which behaviour Ninox adopts, whether always an array or only when there are genuinely multiple records being returned, there are 2 problems with what actually occurrs. Firstly the success or otherwise of the formula should ALWAYS be the same. Display perfectly one moment then deciding differently after merely switching screens and back is clearly WRONG. It seems Ninox is executing different code at different times when displaying a column.

    Secondly,  deleting the column without any error message and/or chance for the user to go back and edit the formula is simply a poor UI, very poor.

    Only after puzzling with this for some time did I realise I could simply select the desired fields directly without needing any 'select' at all. I had initially been following examples I had seen probably on this forum.

     

    I have since experienced this same column deletion problem when using numbers(MultipleChoiceDynamicField). This also will display initially, but the column will have vanished after switching screens and back. It is content to display those numbers at first, but not later. Wrap it in a text() function seems to solve the problem.

     

    In both these cases, the problem is not so much that it behaves one way or the other. The issue is that whichever behaviour it adopts, it must ALWAYS adhere to that and behave consistently. Only then can it be documented so everyone knows and can deal with it appropriately.

    • Alain_Fontaine
    • 2 yrs ago
    • Reported - view

    The issue with "numbers" is of course the same as with "select", namely that Ninox has a problem with formulas returning an array appearing as a column in a tabular view. The text() function produces a string representing the content of the array, which works around the problem. One could argue that it is a bug, since Ninox can display (a string representing the contents of) an array in a regular formula field, at least for some types of elements. At first glance, it seems that the result is the same as if the "text()" function had been applied. The "initial" display is probably the correct behavior, and then the problem rises its head.
    As for the "select" statement: it may be that this command would have been better with another name. Using the same name as in SQL gives the false impression that Ninox's "select" has the same semantics as the SQL "select" command. It is definitely not the case. So, it could be that experimented SQL programmers expecting kosher SQL semantics would be happier with some other piece of software.
    In the realm of Ninox's "select", always returnning an array looks like a sensible design choice. It is consistent. If you need a plea for consistency, just look above in this thread. The returned array can have zero, one or several elements, and you have the full complement of functions operating on arrays to handle it. You can check the number of elements with cnt(), iterate on the elements, extract, whatever.

Content aside

  • 2 yrs agoLast active
  • 15Replies
  • 812Views