giving ios file a custom name
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
giving ios file a custom name
i need to create a file and name it the variable . any suggestions on how this might should be done
Re: giving ios file a custom name
Hi kcwvc52,
basically you need to create the filename first and then write your content to that file,
e.g. write a file into the users documents folder:
...
## The variable -> tFilename holds the... well you guess
## Supposed you want to write a "simple" text file
put tFileName & ".txt" into tFile
put specialfolderpath("documents") & "/" & tFile into tFile2Save
put "whatever...***" into url("file:" & tFile2Save)
## *** whatever can be the content of a field or a variable or erm... whatever
...
Best
Klaus
basically you need to create the filename first and then write your content to that file,
e.g. write a file into the users documents folder:
...
## The variable -> tFilename holds the... well you guess

## Supposed you want to write a "simple" text file
put tFileName & ".txt" into tFile
put specialfolderpath("documents") & "/" & tFile into tFile2Save
put "whatever...***" into url("file:" & tFile2Save)
## *** whatever can be the content of a field or a variable or erm... whatever

...
Best
Klaus
Re: giving ios file a custom name
this is good but one problem. if the contents of the file is empty it returns the name of the field in the blank. its easy to create a workaround for a file that has a static name. does anyone have a suggestion on this?
Re: giving ios file a custom name
Hi kcwvc52,
My solution was about WRITING to a file.
Just kidding, what exactly is your problem?
I have no idea what you are looking for.
Best
Klaus
You bet!kcwvc52 wrote:this is good
Not in my solution! So this is another question, right!kcwvc52 wrote:... but one problem

What exactly are you talking about?kcwvc52 wrote:if the contents of the file is empty it returns the name of the field in the blank.
My solution was about WRITING to a file.
If its easy, why do you need a suggestion?kcwvc52 wrote: its easy to create a workaround for a file that has a static name. does anyone have a suggestion on this?

Just kidding, what exactly is your problem?
I have no idea what you are looking for.
Best
Klaus
Re: giving ios file a custom name
i found the workaround i just forgot to delete that post. so if you have a button that is meant to load a file from a field but no information is in the field. you click that button (this stores empty into the file) also lets say on openstack you want to put the file into the field. well if the file is empty, it will put the name of the file into the field for some reason instead of the content which is empty. i was saying it was easy when a static name was used not a variable. its really weird because 2 different results happen with when using statics and variables for the file name. if you need further idea of what i mean i can send you a sample stack
Re: giving ios file a custom name
Hi kcwvc52,
cant you just check:
...
put tFileName & ".txt" into tFile
put specialfolderpath("documents") & "/" & tFile into tFile2
if there is a file tFile2 then
### do the right thing...
else
### do another right thing...
end if
...
And
...
if fld "the field with the filename" = empty then
### Do your default stuff...
else
### Use it for the filename...
end if
...
?
Best
Klaus
cant you just check:
...
put tFileName & ".txt" into tFile
put specialfolderpath("documents") & "/" & tFile into tFile2
if there is a file tFile2 then
### do the right thing...
else
### do another right thing...
end if
...
And
...
if fld "the field with the filename" = empty then
### Do your default stuff...
else
### Use it for the filename...
end if
...
?
Best
Klaus