Update an Resource

Update an Resource

  

Hi,

I have a problem, I use an extension called FileSystem, also I use an File_WriteText action to update an resource, called " i18nJs.js " , it's into a folder inside my refereced module called TwprojectGantt.

When I running my action to the update the resouce, it's works, I can see the alterations because i set up a tablerecord, inside a webscreen, with action Directory_ListDirFiles, and return a list of file this directory:


 "C:\Outsystems\Sandboxes\NYFVYY010\Platform Server\running\TwprojectGantt\libs"


When I open the file I see the update I made.

However when I go to the my module refereced and open the file in that folder, mantains the original and it's don´t have the updates.

if it's the same root of the file, and I see the update i have made, and if is the same file, why that's don't happen in my referenced module, i don't understand.


Thanks,

Diogo Costa.

Hi Diogo,

Every resource you include into the resources folder inside a module is embedded into oml and will be publish to the deploy target when you module was published. In runtime, you will be able to replace this resource. So, you could find the new resource as you said. But inside the module you always will get the original file unless you change it inside the service studio.

If you need manage this file in runtime frequently, I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime or put the resource on database keeping the latest version that should be deployed into that folder every time you need.



Maybe he could also right click on it and exclude it, but then he needs to create it on every new instance of the program. It isn't a good idea by the way to let your program update this kind of resources, with every publish the version in your source will replace the version again you you need to keep a good track of which version is where.


regards,

Wim

Fantato wrote:

Hi Diogo,

Every resource you include into the resources folder inside a module is embedded into oml and will be publish to the deploy target when you module was published. In runtime, you will be able to replace this resource. So, you could find the new resource as you said. But inside the module you always will get the original file unless you change it inside the service studio.

If you need manage this file in runtime frequently, I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime or put the resource on database keeping the latest version that should be deployed into that folder every time you need.




Hi Fantato,

What you mean with " I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime ".

I don't understand what you are sayin, can you show me a example, please ?


Thanks,


Diogo Costa.

Diogo Costa wrote:

Fantato wrote:

Hi Diogo,

Every resource you include into the resources folder inside a module is embedded into oml and will be publish to the deploy target when you module was published. In runtime, you will be able to replace this resource. So, you could find the new resource as you said. But inside the module you always will get the original file unless you change it inside the service studio.

If you need manage this file in runtime frequently, I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime or put the resource on database keeping the latest version that should be deployed into that folder every time you need.




Hi Fantato,

What you mean with " I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime ".

I don't understand what you are sayin, can you show me a example, please ?


Thanks,


Diogo Costa.

Hi Diogo,

The first point is the reason you are trying to update the js file in runtime. Who will do this update? A User with some specific role or only the developer?

If the responsible user allowed to do this updated is the developer. You only need to change the resource inside service studio. Is not necessary to create this logic to put the resource on filesystem. The platform will do it for you. 


But, if you need to replace the file with any users, so you should create some screens and logic to do that. My point in the last answers was to avoid errors if this files was not there in the first deploy. So the bootstrap was required to put an initial version of this file.



Fantato wrote:

Diogo Costa wrote:

Fantato wrote:

Hi Diogo,

Every resource you include into the resources folder inside a module is embedded into oml and will be publish to the deploy target when you module was published. In runtime, you will be able to replace this resource. So, you could find the new resource as you said. But inside the module you always will get the original file unless you change it inside the service studio.

If you need manage this file in runtime frequently, I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime or put the resource on database keeping the latest version that should be deployed into that folder every time you need.




Hi Fantato,

What you mean with " I suggest you create an initial bootstrap using the FIleSystems extension to put the first version of this file on runtime folder and after that only upload new version in runtime ".

I don't understand what you are sayin, can you show me a example, please ?


Thanks,


Diogo Costa.

Hi Diogo,

The first point is the reason you are trying to update the js file in runtime. Who will do this update? A User with some specific role or only the developer?

If the responsible user allowed to do this updated is the developer. You only need to change the resource inside service studio. Is not necessary to create this logic to put the resource on filesystem. The platform will do it for you. 


But, if you need to replace the file with any users, so you should create some screens and logic to do that. My point in the last answers was to avoid errors if this files was not there in the first deploy. So the bootstrap was required to put an initial version of this file.




Hi Fantato,

The reason I'am trying update the js file in runtime, it's because I have a entity with some records and I want update the resource with these records, but in automatically way, so the option "change the resource inside service studio" is not the best way for me , because the Ideia is , implement the action I have done, with a Timer, and when I'll do a update in backoffice, I want update this resource automatically.

However I already understand, inside the module I always will get the original file, unless I change it inside the service studio, but I want it updates the resource in a automatically way and not manually.

You understood my point of view?

Thanks,

Diogo Costa.

Do you have some control on those libraries to choose what the url for that file is?

If that was possible I would change it to the url of an empty Screen. Then in that screen Preparation use a DownloadNode to return the javascript file content instead of the page html. That way you would still be able to keep the information in the database but dynamicaly create the .js file instead of messing up with the filesystem.


Regards,

João Rosado

João Rosado wrote:

Do you have some control on those libraries to choose what the url for that file is?

If that was possible I would change it to the url of an empty Screen. Then in that screen Preparation use a DownloadNode to return the javascript file content instead of the page html. That way you would still be able to keep the information in the database but dynamicaly create the .js file instead of messing up with the filesystem.


Regards,

João Rosado


Hi joão,

I don´t think have control on those libraries, but what I want, is do the updates inside my resource in a automatic way.

I already created the  new resource with my updates but, when I sent the file to this path:  "C:\Outsystems\Sandboxes\NYFVYY010\Platform Server\running\TwprojectGantt\libs", and I go openning the resource in my refereced module, I don't see the alterations, because the module always will get the original file unless, I change it inside the service studio, but I don't want that,I want every time I run the action, the resource updates by yourself.

 I have been thinking about pass the bynary content from my resource to an entity,but my problem is, the resource have an variable called Holidays, then is called in others resources, if I put the binary content to entity, I must change the connection , what bound my ressource to a others ,and they are a lot, I don't know if is a good ideia.

What do you think?


Thanks,


Diogo Costa