1. cappu
  2. RO CSVI
  3. Friday, 26 August 2022
  4.  Subscribe via email
Hi,

I just cannot find information on how to import data directly into a custom fields subform in Joomla 4.

Looking in the database, the subform data gets saved in JSON format.

Therefore I converted my data into JSON as well. Here is an example of the JSON data I want to import:


{"row0":{"field73":"Wohncontainer f\\u00fcr Arztreserve und Krankenschwestern f\\u00fcr ein hessisches Krankenhaus.","field71":"Wohncontainer f\\u00fcr Arztreserve und Krankenschwestern f\\u00fcr ein hessisches Krankenhaus.","field72":"Wohncontainer f\\u00fcr Arztreserve und Krankenschwestern f\\u00fcr ein hessisches Krankenhaus.","field66":"images\\/containerfotos\\/394\\/fensterfront-behelfsunterkuenfte-arzt.jpg"},"row1":{"field73":"Wohncontainer f\\u00fcr Arztreserve und Krankenschwestern f\\u00fcr ein hessisches Krankenhaus.","field71":"Wohncontainer f\\u00fcr Arztreserve und Krankenschwestern f\\u00fcr ein hessisches Krankenhaus.","field72":"Wohncontainer f\\u00fcr Arztreserve und Krankenschwestern f\\u00fcr ein hessisches Krankenhaus.","field66":"images\\/containerfotos\\/394\\/eingangsbereich-4x20fuss-5-2013.jpg"},"row2":{"field73":"Wohncontainer BV N\\u00fcrnberg","field71":"Wohncontainer BV N\\u00fcrnberg","field72":"Wohncontainer BV N\\u00fcrnberg","field66":"images\\/containerfotos\\/394\\/img0141.jpg"},"row3":{"field73":"Wohncontainer BV N\\u00fcrnberg","field71":"Wohncontainer BV N\\u00fcrnberg","field72":"Wohncontainer BV N\\u00fcrnberg","field66":"images\\/containerfotos\\/394\\/img0142.jpg"}}


The Excel Column containing this JSON data gets mapped to the custom fields subform field.

Running the import this data seems not to get imported into the database. What am I missing?

- Is my approach to import the data into a custom fields subform correct?
- If so, what am I missing that the JSON data won't get imported properly?

Thanks for help.

Kind regards,
Bernhard
Accepted Answer Pending Moderation
Hello Bernhard,

- Is my approach to import the data into a custom fields subform correct?

You don't need to use JSON data to import into Subform. Let me explain with an example. Make sure you are using RO CSVI 8.3.2 version to run Subform import as mentioned below.

1. Say you have a subform custom field type. Name of the field is also Subform

169278180-47047555-7d5a-4c90-94f6-8dbb8ae53df9.png

2. We link three fields to it - Date, Venue and Comment.
169278087-6cfc9f9d-b385-4ac2-bf64-23d1f447f787.png

3. Update available fields. You can run the import like example CSV below. Multiple values separated by ~ and individual custom field values separated by |.


"alias";"catid";"subform"
"first-article";"2";"Date#2022-05-17|Venue#test1|Comment#My first description~Date#2022-05-18|Venue#test2|Comment#My second description"


- If so, what am I missing that the JSON data won't get imported properly?

JSON import is not supported and so data did not import.

Please try with the above mentioned format and let me know on how it goes.
Attachments (2)
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hi Tharuna,

thanks for your feedback. I finally could make it work.

In the documentation you call the Custom Fields Subforms Repeteable Custom Fields. herehttps://rolandd.com/documentation/ro-csvi/joomla-content/joomla-custom-fields-import?start=13

I am using rather descriptive field names with empty spaces. Because of this I noticed that I had to use the Custom Field alias, not the name.

Best
Bernhard
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello Bernhard,
thanks for your feedback. I finally could make it work.

Glad to know that you got it working.

In the documentation you call the Custom Fields Subforms Repeteable Custom Fields. herehttps://rolandd.com/documentation/ro-csvi/joomla-content/joomla-custom-fields-import?start=13

In Joomla 3 it is called as Repeatable custom fields and in Joomla 4 it is Subform. You can see the way Subform custom field created in Joomla 4 is a little different from Joomla 3. This document will be updated with Subform custom field type.

I am using rather descriptive field names with empty spaces. Because of this I noticed that I had to use the Custom Field alias, not the name.

Thats correct. You should be using alias and not name.
Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!