[FileSystem] Create a txt file

Forge Component
(33)
Published on 2019-02-21 by João Portela
33 votes
Published on 2019-02-21 by João Portela

Hello every one.


I am new with Out Systems, and I am trying to create a single txt file, but In other forums the they just said tha using a file system plugin or using TetToBinary but I really don't get it, if you coul helpme to do this, I'll really apreciate it, and if it is posible, could you share the steps to do it please? or a tutorial.


Thank you every one

Hi Rafael,

What kind of app are you creating? Mobile, Reactive Web or Traditional Web? What do you mean by "creating a txt file"? Do you want to write text to a file, and store that file on a disk somewhere? You've got to keep in mind that if you are working from a PE, there's no disk to write the file to, and this component is of no use!

Hi Rafael,

Did you install the demo application that shows how to use the FileSystem component?

https://www.outsystems.com/forge/component-overview/68/filesystem

  1. Click on download and select the option "Download component + Demo"
  2. Extract the files from the Zip file that is downloaded
  3. Double click on FileSystem-Demo-3.0.3_O11.oap extracted from the zip file and follow instructions to install it in Service Studio.
  4. Try out and inspect the code to get an understanding of how to use the FileSystem component.

Also as being new to OutSystems, I would advise you to read the article mentioned in the next post:

https://www.outsystems.com/forums/discussion/60240/beginning-your-outsystems-journey/

Regards,

Daniel

Kilian Hekhuis wrote:

Hi Rafael,

What kind of app are you creating? Mobile, Reactive Web or Traditional Web? What do you mean by "creating a txt file"? Do you want to write text to a file, and store that file on a disk somewhere? You've got to keep in mind that if you are working from a PE, there's no disk to write the file to, and this component is of no use!


Hello Killian


I am working with  a  Traditional Web, and I just want like in other languages, to create a new file, not read or write into an existing file, but I dont' kow if it is posible, what I want is to create a file, which content is string,


Thanks for tour answer


Note: What is PE?

Daniël Kuhlmann wrote:

Hi Rafael,

Did you install the demo application that shows how to use the FileSystem component?

https://www.outsystems.com/forge/component-overview/68/filesystem

  1. Click on download and select the option "Download component + Demo"
  2. Extract the files from the Zip file that is downloaded
  3. Double click on FileSystem-Demo-3.0.3_O11.oap extracted from the zip file and follow instructions to install it in Service Studio.
  4. Try out and inspect the code to get an understanding of how to use the FileSystem component.

Also as being new to OutSystems, I would advise you to read the article mentioned in the next post:

https://www.outsystems.com/forums/discussion/60240/beginning-your-outsystems-journey/

Regards,

Daniel


Thank you Daniel, I installed the demo, but  when I test it, it only works with existing files, is there a way to create a new file with its name?, not to write to an existing file.


Thanks for your anwer

Solution

Hi Rafael,

"PE" stands for "Personal Environment", you environment in the OutSystems cloud.

Creating a file is pretty simple, but like I said, you cannot write it to the file system on a cloud server. Instead, you create it, and then you have the user download it.

For downloading, you end your flow with the Download Statement:

You'll notice that it has two mandatory parameters that are not yet pre-filled: File Content and File Name. If you check File Content, you'll see that it's of type Binary Data. Since you want a text file, you'll need to convert your text to Binary Data. To do that, reference the TextToBinaryData Action from the BinaryData Extension:

Call the Action before the Download:

Then in the download specify the output of the Action as File Content:



Solution

Kilian Hekhuis wrote:

Hi Rafael,

"PE" stands for "Personal Environment", you environment in the OutSystems cloud.

Creating a file is pretty simple, but like I said, you cannot write it to the file system on a cloud server. Instead, you create it, and then you have the user download it.

For downloading, you end your flow with the Download Statement:

You'll notice that it has two mandatory parameters that are not yet pre-filled: File Content and File Name. If you check File Content, you'll see that it's of type Binary Data. Since you want a text file, you'll need to convert your text to Binary Data. To do that, reference the TextToBinaryData Action from the BinaryData Extension:

Call the Action before the Download:

Then in the download specify the output of the Action as File Content:



Thanks Killian.


I have access to an development enviroment, so, if I understand, I can follow this steps you gave me to create a file into the cloud filesystem, that is correct?



thanks


Hi Rafael,

No, there is no cloud file system. The steps I described above are for creating a file, then downloading it via the browser.

Kilian Hekhuis wrote:

Hi Rafael,

No, there is no cloud file system. The steps I described above are for creating a file, then downloading it via the browser.


Hello Killian, thanks for your answer, now I get it, and I downloaded the file.


Thanks

Great, glad I could be of help. Could you mark my post as Solution? Now you've marked your own post :).