Jump to content
  • 0

Files in trigger


Kuroshi
 Share

Question

I am creating a trigger wherein I want to pass the File in another table. 
 
So I have Table 1 that collects files.
I have Table 2 that collects files.
Now, I want all these files to be saved in a New Table.
 
Because at some point, our admin needs to view all the files inside my application.
 
When I go to All Assets > Files, I am able to see all files. But what I want is to view them inside my DataPage.
 
So I come up with a solution that I need to store all these files inside a single table. And then, from there, I can easily create a DataPage that will use this Table (with all files across tables)
 
Now the problem is....
 
I can't use the File field inside a trigger. =( 
 
How can I use the Files inside my trigger? Any help will be appreciated.
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @Batchini,

Unfortunately, you can not use File DataType inside triggers.

If your files isn't sensitive, you can just enable FileStor, and save your files there.

So this would be the process:

First: 

You need to get the link for your FileStor Folder.
https://eucdn.caspio.com/XXXXXXXX/folder_name/
where XXXXXXXX is your unique CDN account ID. 
You can follow this link to get the unique CDN account ID:

 

Next is to create a formula field inside your Tables with this syntax:

'https://eucdn.caspio.com/XXXXXXXX/folder_name/' + CAST([@field:Attachment] as NVARCHAR(max))

Wherein you're going to concatenate the Filestor folder link to the name of the file uploaded.

Once all these is done, you can use this formula field to the trigger. 

It's like passing the link of the file instead of the actual file.

And by the way, this method will lessen Data Transfer and avoid you to have duplicate files.

Final reminder, Filestor are only available in some plans.

I hope this helps.

 

Glitchin' 

Link to comment
Share on other sites

  • 0

There is actually a tricky workflow for this one. 

If you need to move your pictures to another table for 1 time use only, you may try the following:

1) Convert the field for handling the files into a text255. With that, the file it has will be converted into a directoty.

2) Use task to copy that directory to another table. The receiver should be a text 255 as well.

3) Convert those text255 fields into file data type again.

If you will be needing to pass them time to time, I suggest that you try this one.

1) On your main table, take the ID of record which has the desired image.

2) On the destination table, create a field that will handle those ID.

3) Create a view that links those 2 tables base on that ID, then only include the file field on the main table to the destination table. Use this view as a datasource of your DataPage.

With this, you will be able to move the ID of the file freely. 

Hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...