0

I am still learning how to work with craft on the back end but so far I can see it is a very powerful platform!

I was wondering if there is a way that within an existing entry channel say "foo" I have an entry comprised of a table made up of multiple numerical values under specific headings (say column A has a value of 1, B:2, C:3,..Z:X)- I was wondering if there is any way that I can grab the values in columns A:1 and B:2 from the table entry in channel "foo" and create a new entry under a different existing channel "bar" where those two values A:1 and B:2 are pre-filled in the new entry type form?

Apologies if this is confusing- I am attempting to eliminate the steps involved in copying values from one entry type (large table of values) to another entry type (a form made up of fields that make up content on the front end of the site) and consolidate it into one step where I can find the row containing the values I need in channel "foo" and just click to create a new entry type with those values pre-populated in channel "bar"- eliminating the need to copy and paste the values.

I am not sure how to tackle this or where to begin as I am still new with the platform.

Thank you in advance for any help!

5
  • Hey! This is an interesting question. Are you able to share a little more context? There might be an alternative way to achieve what you're asking. Are the values for A,B,C etc always going to be the same? – dmatthams Oct 1 '20 at 9:19
  • @dmatthams Yes! I have a Channel "foo" which contains an entry-"Entry 1" and "Entry 1" contains a table with lets say 4 columns - A,B,C,D. The table has the values pre-inserted for A,B,C,D in the rows. Currently, if I want the values from columns C and D inserted into a new Entry under channel "bar" I have to go in and find the row which corresponds to the data I want and individually copy those values from "foo"->"Entry 1" to "bar"->New Entry. Is it possible to create a new entry within a different channel with C & D pre-populated on save, or maybe a lightswitch toggle? Thank you! – Gideon B Oct 1 '20 at 14:48
  • @dmatthams I am wondering if this is a situation where I would use relations? I guess for clarification, the idea is that I can pre-enter a series of relative latitude and longitude values in an entry table and then, whether through a lightswitch or check I can toggle that pair of values from the longitude or latitude columns to pre-populate into a 'latitude' and 'longitude field in a different entry which is then linked to a marker which displays on a leaflet map on the front end. Or if there is an easier way to do this? Thank you again! – Gideon B Oct 2 '20 at 3:08
  • Yes I'm wondering if relations would help here. You could potentially have two new sections (or perhaps categories is better suited), one for lat, one for long. All the lat entries could have a relation to the associated long, and vice versa. Then in your "foo" channel you create a relation that allows you to select the lat or long entries. On your front end you can then pull the related lat/long. Does this make sense? – dmatthams Oct 2 '20 at 8:33
  • Just wanted to let you know but I made some progress. While looking into relations I noticed I could create a separate tab in the entry that would house the table which I had as a standalone entry previously. That way I was able to set all of the coordinate pairs as default values in the table with a lightswitch to toggle them on or off. This way you can now create a new entry and select which marker you want on. Now the issue I am having is passing the row.latitude and longitude values from the entry template to my js script to place the marker on the map on the home page. Thank you again! – Gideon B Oct 2 '20 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.