Aller au contenu principal

Migration FS_LIST to FS_CATALOG (in DB-Schema template)

Commentaires

9 commentaires

  • Zendesk API User
    Author: Nitros - 6/11/2020 14:12

    I think you are mixing up Dataset and Entity here. From the Documentation: "#row returns an object of the data type Entity". However, the syntax you use here suggest you want a Catalog object. This can only be gotten from the FormData of the Dataset as far as I know. You could try #global.dataset instead and then follow the API of Dataset.

    As a general tip: Try adding .class to then end of an expression and debug print it. This way you can figure out if the return type is what you expect.

    0
  • Zendesk API User
    Author: o5_puschnig - 6/11/2020 14:30

    Thanks for the answer!

    Yes, I want a Catalog object because in the form I have a FS_CATALOG component. So how can I access its entries, or fields of the entries in the page here (btw. the same question if I used a FS_INDEX component)? Is there no way to do this via #row??

    I cannot find any information about #global.dataset, do you have a link maybe?

    0
  • Zendesk API User
    Author: o5_puschnig - 7/9/2020 15:58

    Hello,

    as this has not really been answered yet, I would like to ask if anyone else could help here.

    When I print the value of #row.gallery.class I get "de.espirit.firstspirit.generate.IdentifiableFormDataList", but I do not know how to access its members. I could not find any documentation about it and as said before when checking with size or isEmpty the list always seems to be empty although there are existing entries in it.

    Has anyone else successfully iterated over a FS_CATALOG component inside a DB Schema template before?

    0
  • Zendesk API User
    Author: bianca_batsch - 7/10/2020 8:31

    Hello Ingmar,

    could you provide more information of your construct? What are the elements of the form? How are they mapped to the DB? How is the code in the output?

    Best regards

    Bianca

    0
  • Zendesk API User
    Author: o5_puschnig - 7/13/2020 11:39

    Hello Bianca,

    in the form of the DB Schema template we have the following FS_CATALOG component which was migrated from an FS_LIST component:

    <FS_CATALOG name="ptGallery" useLanguages="no">

            <LANGINFOS>

              <LANGINFO lang="*" label="Gallery pictures" description="Choose up to four pictures, please use only the 'Picture' tab."/>

              <LANGINFO lang="DE" label="Galeriebilder" description="Wählen Sie bis zu vier Bilder aus, bitte nur den Reiter 'Bild' verwenden."/>

            </LANGINFOS>

            <TEMPLATES type="section">

              <TEMPLATE uid="st_picture_text_linklist__tt"/>

            </TEMPLATES>

          </FS_CATALOG>

    The template "st_picture_text_linklist__tt" is a paragraph template which provides the information for a picture.

    The field "ptGallery" is mapped to the DB column "gallery"

    Here is the HTML output of the the DB schema template:

    $CMS_IF(!#row.gallery.isEmpty)$

                    <div class="thumb">

                    $CMS_SET(setPurpose,"productthumb")$

                    $CMS_SET(setTitle,#row.name)$

                    $CMS_SET(count,0)$

                    $CMS_FOR(picture, #row.gallery)$

                        $CMS_IF(count <= 3)$

                            $CMS_VALUE(picture.item)$

                            $CMS_SET(count, count + 1)$

                        $CMS_END_IF$

                    $CMS_END_FOR$

                    </div>

                    $CMS_END_IF$

    Please let me know if you need more information and thank you very much for your support!

    0
  • Zendesk API User
    Author: bianca_batsch - 7/13/2020 11:48

    Hi Ingmar,

    why do you use #row and not ptGallery? Is there anything I dont recognize?

    Greets Bianca

    0
  • Zendesk API User
    Author: o5_puschnig - 7/13/2020 13:13

    Hi Bianca,

    that is a good question. The template was built before using #row for accessing every element. For most elements this seems to work and I think it also worked for the FS_LIST element before. I assumed using #row was necessary because we have a DB schema template.

    However, I tried your suggestion and used ptGallery and this seems to work here! I would be very thankful if you could explain briefly when to use #row and when not.

    Thank you very much!

    0
  • Zendesk API User
    Author: bianca_batsch - 7/13/2020 13:34

    Hello Ingmar,

    AFAIK:

    • #row is for direct accesssing the DB-Entries / Information
      • for Catalogs here there is XML-Data to parse
    • ptGallery is for acessing the form
      • Form-Items to parse

    I would always use the Form-Data, unless there is no other way to access the Data

    0
  • Zendesk API User
    Author: o5_puschnig - 7/13/2020 13:38

    OK, thanks again. Your information was very helpful!

    0

Vous devez vous connecter pour laisser un commentaire.