Page 1 of 1
giving ios file a custom name
Posted: Sun Jun 12, 2011 11:02 pm
by kcwvc52
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
Posted: Mon Jun 13, 2011 11:54 am
by Klaus
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
Re: giving ios file a custom name
Posted: Sat Jun 18, 2011 3:15 am
by kcwvc52
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
Posted: Sat Jun 18, 2011 11:04 am
by Klaus
Hi kcwvc52,
kcwvc52 wrote:this is good
You bet!
kcwvc52 wrote:... but one problem
Not in my solution! So this is another question, right!
kcwvc52 wrote:if the contents of the file is empty it returns the name of the field in the blank.
What exactly are you talking about?
My solution was about WRITING to a file.
kcwvc52 wrote: its easy to create a workaround for a file that has a static name. does anyone have a suggestion on this?
If its easy, why do you need a suggestion?
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
Posted: Sat Jun 18, 2011 7:21 pm
by kcwvc52
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
Posted: Sun Jun 19, 2011 6:36 pm
by Klaus
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