0

stumped

Failing to set up a simple calculation for a column. As an example:-

if fasst.Id then
    let reg := "yes";
else
    let reg := "no";
end
reg

This fails with "End expected: reg at line 6, column 3" and I cannot see why. It's a simple test that should display 'no' or 'yes' depending on whether the fasst.regno column is blank or not, but it just won't do it.

 

If I remove the last line, there's no error, but of course nothing is displayed.

 

I'm sure I've done something similar before and had no trouble, but cannot fathom what the problem is here. Suggestions welcome.

8 replies

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

    Try:

    let reg := if fasst.Id then "yes" else "no" end

    reg

    Steven

    • UKenGB
    • 2 yrs ago
    • Reported - view

    Thanks, I worked out an alternative solution, but why does the above fail? Is there some underlying reason why declaring a variable value cannot be done inside an 'If' statement?

     

    Interesting to see however that one can assign the result of an 'If' to a variable.

    • PJSpark
    • 2 yrs ago
    • Reported - view

    You need a semi-colon after the end of the if block, since you have another statement following. Actually the semi-colons you use aren't necessary because there are no other commands following in each of the truth or false parts. In this case, however, assigning to a variable is really not needed. If you leave off the variable, it will return yes or no and no semi-colons would be needed.

     

    Peter ...

    • John_Halls
    • 2 yrs ago
    • Reported - view

    I'm not saying to use it, use Steven's code, but your code should have looked like this

    let reg := "";

    if fasst.Id then
    reg := "yes"
    else
    reg := "no"
    end;
    reg

     

    Regards John

    • UKenGB
    • 2 yrs ago
    • Reported - view

    Thanks for pointing out the obvious. I mean that. The words 'trees', 'wood', 'see' and 'cannot' come to mind, but not necessarily in that order.

    I figured it out after my last post. There are a lot of Ninox subtleties to grasp and that can sometimes obscure a basic coding error I've made.

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    UKenGB - 

    Been using Ninox for now nearly 2 years and still on that learning curve !!!.

    Ninox catches you out because cos it does some things code wise in odd ways and as the online manuasl is still a few years out of date!

    You have to guess at what the improvements/additions/corrections to code lexicon are.

    Fortunately, there are some very clever colleagues using this forum who never seem to sleep!

    I guess we are all learning together (still!)

    • Generation D Ltd
    • Quentin_Brown
    • 2 yrs ago
    • Reported - view

    You seem to be picking it up much better than I am UKenGB.

     

    Asking a lot of good questions much better phrased than I would have.

     

    I'm essentially coming from a similar place I think, some experience of coding in various languages, previous Database experience, awareness of SQL and basic under the hood stuff and thorough stuck trying to understand the Ninox approach which is different under the hood and keeps a lot hidden to make it more approachable for spreadsheet people.

     

    Documentation is terrible and I find the Nioxus training videos excrusiatingly long winded as they are targeted at thos same kind of basic computer users! If he could just get to the point I could wizz through those 1 hour lessons in 5 minutes! I wish there were a manual and traing more targeted at poeple coming with previous knowledge like us just aimed at explaining the quirks and under the hood stuff that diverges from what we might be used to. Ninox seem powerful and is very affordable but learning it is like fighting through fog and frustratingly feels like it could be so much simpler to learn if it was documented right for us!

     

    All that said, I did learn in the hours of training videos I have suffered through that within Ninox variables only exist for as long as the function they are declared within.

     

    The biggest challenge I'm struggling with right now is fully understanding how selects, paths, and linked tables all work and interact when you call them in code (connecting vs returning arrays vs ???) it all seems a bit mysterious. I wish there was a little variable tracker so you could look at the full contents of a variable and progress line by line through you code watching the value in it change. That a feature I've seen in other devolopment platforms that can be really handy.

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Quentin

    There is a manual but is it is quite basic (and out of date!) https://ninox.com/en/manual/introduction/basics

    I think what you would like to see is a bible or teccy version (so would I :-). There is nothing like reading a large technical manual in bed to keep you awake!

    Like you, coming from other vaious software that was well supported document wise it is a learning curve. Especiialy when you are used to defining relationship links by specifying a unique key to foreign keys. etc. Ninox - You link a table and whole table is linked !

    All I can say is hang in there - There is some fantastic help to bg had from some very clever people using this (user!) forum and surprisingly - once you stop trying to do things based on what you already know! ie throw it away !- Ninox does become quote clear quickly.

    It's actually a great piece of software! far from perfect by anymeans but useful and practical!

    Mel

Content aside

  • 2 yrs agoLast active
  • 8Replies
  • 535Views