• 0
DesiLogi

Copy image field from one table to another in Submission form

Question

Hello,

Is there a way to copy an image field from one table to another in a Submission form? I'm using Cascading Text to grab values from fields from a table (based on an ID identifier for the record) and put them into the fields for another table on a Submission form but cannot get the image field to do this. Some kind of workaround would be really great. 

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

This might work....

 

Create a View with Both Tables

- the table/field that will be updated , make editable

 

Choose the view as datasource in the submission form

 

Use the Resizer option

 

in File Field Name , give it the field name you want to copy to.

 

And, Instead of giving resized options, you could just give it the same width and height as the original.

 

 

attached pic below.

 

 

Save_Image_In_Another_Field.JPG

Resizer_Options.JPG

Share this post


Link to post
Share on other sites
  • 0

Hi Twired,

Thanks for the tip on this. I created a View as you mentioned but the problem is that the file I need to copy is in the table that the submission form doesn't give the option to list fields for (because it only allows fields on the editable table, which is the other table).

So I have table:TableA with the file images field:mysavedImage

I need to copy that image to table:TableB into field:mynewImage

I've created a View with TableA and TableB, linked by an ID field.

The issue, unless I'm misunderstanding something, is that on the Submission form I can list TableB.mynewImage but I can't figure out how to get TableA.mysavedImage on that form. It won't allow TableA fields because it's not the editable table. 

I'll play around with it and see what I can do- thanks for the direction on this- 

Share this post


Link to post
Share on other sites
  • 0

 

 

Just some pointers:)

----------------------------

1) One cannot copy a file or image to another table, just by code on the front end (lets say javascript) . Its because of security reasons its disallowed.

There has to be user intervention (choose and submit) by the user to do that.

2) in caspio, images/files are not actually stored in the table,

A file or image is actually stored in a folder (>> All Assets , Click on Files)

>> ONLY a URL Link or path to the file is stored in the table field

 

So basically , you dont need to "copy" the image over.

*if you want to, you can copy the path to the image, in another tables field . The copied-to field must be a text field.

 

After Submission of the saved image,

whenever you want to reference the image , do so with a view (which has both tables)

 

So if you create a relationship/Join between the 2 tables.

-------------------------------------------------------------------------------------------

Table 1                                         Table 2

Table1ID (autonumber)           Table2ID (autonumber)

                                                      Table1FKID (Integer)   << Foreign Key Join

Table1  (Table1ID)  >>One to Many >> Table2 (Table1FKID)

 

Create a View

------------------------

Inner Join

Table1  (Table1ID)  >>One to Many >> Table2 (Table1FKID)

 

Results or Report data Page (Referencing the saved image from Table 1 : in reports from other tables)

---------------------------------------------

 

Use the View above as Data Source.

 

Heres a working demo

http://www.tripatwork.com/tagnt-test-2.html

 

 

If you need any help, let me know...:)

Thanks !

 

 

 

Share this post


Link to post
Share on other sites
  • 0

Hi Twired,

Thanks for the tips on this- I do understand re an image not being stored in the table but instead the path to that image is stored and then the image grabbed to open (that's how I used to set up my Access databases with image files). I believe what you're suggesting above is referencing the original image via a joined table in a View. Unfortunately, this isn't what I need to do. I need to actually duplicate the image into the new table. 

This is because the data in one table is used as a reference point to add records to another table but beyond that the are not relatable. As in table1 is a 'Catalogue' with records to draw from. Those records are used (sometimes) to populate records in table2 'Items' which are actual physical 'items and work' on a project. Once a record is in the Items table it is independent and can be changed in many ways. Likewise, the Catalogue record that was used to first 'create' the Items record can and will be changed. The image may be changed along with other information- but the 'Items' record that was made for it needs to NOT change also (because it is now an independent entity). Meaning if an image in the Catalogue record is changed then the image in the related Items record must NOT also change. So a View with joined tables would not work for this. 

This isn't a relational database 'don't duplicate data' issue- in this particular case I do actually need to duplicate some records, instead of using FKs. 

Hence, my query about how to duplicate the image into the new table. As per your explanation above, I was hoping to be able to duplicate the image path to the new table, into the image field. Because users enter data in this table in a few ways, manually as well as by copying from the 'Catalogue' table- so images need to be in a single field for displaying purposes. I can't have a field for manual upload when a record is manually created, and a separate (text) field for a 'copied' record from the Catalogue. The image field is used all over the app and if there are 2 fields (one an image field, one a text field from copying) it will not work in many (complicated) displays. 

So the fact that an image file must be user-uploaded (thanks for pointing that out) means that I can't copy the image path itself into an 'image' field, only to a text field. So that's a no-go, unfortunately. 

I had Caspio do some custom work on duplicating records in this way but was hoping to avoid that expensive and time-involved route, if possible. If I come across a solution I'll definitely post it here for others. Also, thanks again for your help on this- much appreciated either way. 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now