0

If statement not running

Hi

I am attempting to run the below code and I have encountered a problem that I cannot seem to resolve!  Everything works except the bold section, which I don't think is actually running.  The underlined piece just before it runs ok and shows that the same value is contained in the variables compare1 and compare2 which should mean that the bold section runs - but it doesn't.  I've even added the trim and string in case it was a length or format issue but to no avail.  Any ideas would be much appreciated!

for deepDiveRecord in select 'Final Levels' do
let compare1 := deepDiveRecord.Pair;
let compare2 := currentPair;
currentMessage := currentMessage + "Comparing :" + compare1 + " and:" + compare2 + "
";
if trim(string(compare1)) = trim(string(compare2)) then
currentMessage := currentMessage + "Pair:" + deepDiveRecord.Pair + currentPair + "Time Frame:" + deepDiveRecord.'Time Frame' + " Level:" + deepDiveRecord.Level + "
"
end
end;
currentMessage := currentMessage + "

"

8 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    As far as I know there isn't a string() function. Try this...

     

    let compare1 := text(deepDiveRecord.Pair)

     

    and then do the comparison. I'm fairly confident you are comparing an object to something that isn't an object.

    • Sean
    • 4 yrs ago
    • Reported - view

    I'm correcting myself... there is a string() function. Another undocumented function in the Ninox manual! How hard can it be to update your bare-bones manual?!?!

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

    Not even in the German-version site is it documented and not even in the German webinar team 0001_Ninox-Referenz database. 

    Sometimes Ninox is difficult to fathom... 🤷‍♂️

    How many functions are still out there, undocumented?  no one knows ... 

    • Sean
    • 4 yrs ago
    • Reported - view

    @aussiemckenna, I don't want to hijack your thread. If you're still having problems let us know.

     

    @Steven, It's frustrating that so little effort is put into keeping the documentation up-to-date. It's not like they have to bother with updating hyperlinks since the Scripting Reference page is monolithic. I didn't know the join() function existed until I saw a solution that Leo posted on the forum and it wasn't until after I posted a complaint about it not being documented that the Reference page was updated to include it.

    • aussiemckenna
    • 4 yrs ago
    • Reported - view

    Hi both, yes I'm finding Ninox so powerful yet amazingly frustrating!  

    @Sean, your answer didn't directly solve but it did set me down a road which eventually got me there!  CurrentPair was a multi select variable which shows as the answer when referenced directly but as its number when converted to a string - go figure!  

    Anyway, i got there in the end so that you both!

    Anywhere====

    • aussiemckenna
    • 4 yrs ago
    • Reported - view

    Just to add to the case for proper documentation, i find i have to try everything (even simple loops or for/next routines) 10 different ways before I might happen on the right solution so having real world examples would be a huge time saver. Got to be worth it from a economics perspective Ninox! A less determined user would've walked away I'm sure!

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

    Found something interesting with the string() function. It gives back the hexadecimal value of a Multiple choice field.

    You can even manipulate the choice field by giving a hex value to that multiple choice field.(here with a button)

    Steven

    • aussiemckenna
    • 4 yrs ago
    • Reported - view

    Wow the plot thickens, that's definitely one for the notebook! Thanks again!

Content aside

  • 4 yrs agoLast active
  • 8Replies
  • 2274Views