0

"This formula may not change the data."

I have a button to create a file :

'File XSPF' := createTextFile(this, 'Code XSPF', Name + ".xspf")

I have a formula field to open the file like with a button :

'File XSPF'

I would like to have just one thing to open the file, but if I put in the formula field  the script :

'File XSPF' := createTextFile(this, 'Code XSPF', Name + ".xspf")

I get the Alert :

"This formula may not change the data."

How can I do to open the file directly with just a button or just a formula field but not with the two things ?

10 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    I'm kind of confused by what you have posted...

     

    1) You have 'File XSPF' := createTextFile(this, 'Code XSPF', Name + ".xspf") and the following line says that 'File XSPF' is a Formula field. You can't assign a value to a Formula field outside of the Formula field itself.

    2) You say you would like to have one thing open the file, but you are creating a file in your example.

     

    I'm not sure whether you want to combine creating and opening into a single operation or if you just want a way to open the file. Having said that, I don't think you can combine operations.

     

    I found the behavior of the Button element to be inconsistent... You can create a text file with code, but you can't put this code in a Button to open the text file...

     

    file(this, "MyFile.txt")

     

    You can put that code in the "Formula" section of a Formula field and it will open the file, but if you put the code in the Formula field's "On click" section it doesn't work. Kind of a head scratcher.

    • Alejako
    • 4 yrs ago
    • Reported - view

    I see the same issue when I create a Formula in my Ninox db. The formula is good and full working, I test in copy and paste the Formula and the copy to another trigger and don't work I only can see the "This formula may not change the data." message

    • Retraité
    • Eric_Plet
    • 4 yrs ago
    • Reported - view

    My goal is to create a text file and then open it, with a single script.
    The file is in XSPF format and it is opened on Mac with the default application to open .xspf files which, in my case, is: VLC. Which allows me to launch a playlist from Ninox.

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

    just to understand your case more... What happens when you put a spiff file in an image field and then click on it? Does it opens VLC? In that case you could say like Image:= 'your .xspf file' (i know if there is a pdf in it, it opens that pdf)

    Steven

    • Sean
    • 4 yrs ago
    • Reported - view

    @alejako, The "Formula" section can't modify data, but the "On click" section can.

     

    @Eric Plet, I couldn't get both to work in a single script. Even if I put the create code in the "On click" section of the Formula field and the open code in the "Formula" section, only the "On click" section works. What code are you using to open the file?

    • Retraité
    • Eric_Plet
    • 4 yrs ago
    • Reported - view

    I give an example in video :

    https://youtu.be/rTiuARcX5c0

    • Retraité
    • Eric_Plet
    • 4 yrs ago
    • Reported - view

    "VLC Liste Ninox" is a formula field (that I use like a sort of button ...).

    In the formula of this field just the name of an image field

    • Retraité
    • Eric_Plet
    • 4 yrs ago
    • Reported - view

    In the image field there is a XSPF file.

    • Alejako
    • 4 yrs ago
    • Reported - view

    @Sean, I see my issue I must first create a trigger and after I will paste the copy code and all  work fine.

    • Sean
    • 4 yrs ago
    • Reported - view

    @Eric Plet, I still can't combine create and open, but if I click on the Image field it will open the text file I created. You could at least delete the Formula field that you use to open the file. Maybe someone else can get it to work.

Content aside

  • 4 yrs agoLast active
  • 10Replies
  • 2590Views