How to call entity name

If someone has already asked this, I apologize in advance. I am not an experienced PHP programmer, and have searched many places without gaining understanding.

I have used an entity field in a metadata element to control consistent entry of names. Type in the name and the field is filled in from the list that comes up. On the form, this is ca_objects.title_block.project_name.

However, I do not know how to call this field up for display in Pawtucket. The other title block detail elements, which are text fields, come up fine after coding them in ca_objects_default_html.php. I recognize that the project title entry is being saved in the entities_labels table, but don't know how to get to it for display on the web page.

Can someone kindly tutor me?

Thanks,

Mark

Comments

  • Just to be certain I understand, you have a container metadata element with code title_block as part of your object record? And within the container is an entity reference metadata element with code project_name?

    If that's the case ^ca_objects.title_block.project_name.preferred_labels.displayname should return the name. In some versions, pulling data off of those references is problematic, so if that doesn't work please let me know what version of Pawtucket you're running.

  • Thanks as ever for your support, Seth. I have Pawtucket 2.0 installed.

    I simplified the labeling in my earlier post. The metadata element is arch_draw_title_block There is a project_name element in that which uses a lookup from the entity table to record an existing entity value during data entry in Providence.

    Here's the code I have, incorporating your last suggestion:

                   {{{<ifdef code="ca_objects.object_sort_term.name_sort_text"><H6>Project Name</H6>^ca_objects.object_sort_term.name_sort_text : : ^ca_objects.arch_draw_title_block.project_name.preferred_labels.displayname<br/></ifdef>}}}

    [the two colons are meant as a graphic device separating the sort term from the project name in the display line]

    This is probably caused by my ignorance. I attach a screen capture showing where the project name is supposed to appear.

    Again, thank you for your time,

    Mark

    2703 x 1297 - 872K
  • Hi,

    Did you clean the cache of Pawtucket after changing the display? (Delete all files inside pawtucket /app/tmp/)

    If not, you could not see the modification.

    Try this :

            {{{<ifdef code="ca_objects.object_sort_term.name_sort_text"><H6>Project Name</H6>^ca_objects.object_sort_term.name_sort_text : : ^ca_objects.arch_draw_title_block.project_name<br/></ifdef>}}}

  • Thank you for the response. Cleared the tmp files, used a browser with no existing cache, and changed the code to the above suggestion. I had tried that code numerous times before, but copied yours. No change in the missing result.

    Mark

  • Strange. Could you confirm that arch_draw_title_block is a container type element?

  • Yes. It is a container. Within that is the project_name entity line. I attach here images of design screens of the metatdata elements, and an image of the record screen as it appears in Providence. I will have the same issue in getting the values for Primary Attribution and Secondary Attribution to display, which are also entity look ups.

    Thanks for your time.

    857 x 1757 - 292K
    793 x 1358 - 213K
    1017 x 1724 - 359K
  • Hi,

    Ok, all seems to be good...

    And you confirm that this container is not itself included in another container?


    Did you ever try to insert these somewhere in your display? (Always clean Pawtucket's tmp directory after each change)

     {{{Test1: ^ca_objects.arch_draw_title_block.project_name<br/>}}}

     {{{Test2: ^ca_objects.project_name<br/>}}}

  • Your help is appreciated. I added the test code lines and attach image of result. Also, the container arch_draw_title_block is shown in the second image as part of the UI object.

    The following code works fine to get the drawing format, drawing type, medium, date, and so forth. It is failing only on the lookups from the entity table.

     {{{<ifdef code="ca_objects.object_sort_term.name_sort_text"><H6>Project Name</H6>^ca_objects.object_sort_term.name_sort_text : : ^ca_objects.arch_draw_title_block.project_name<br/></ifdef>}}} <---Fails

                     {{{Test1: ^ca_objects.arch_draw_title_block.project_name<br/>}}} <-- Fails

                    {{{Test2: ^ca_objects.project_name<br/>}}} <--Fails

                   {{{<ifdef code="ca_objects.arch_draw_title_block.arch_draw_format_text"><H6>Drawing Format</H6>^ca_objects.arch_draw_title_block.arch_draw_format_text<br/></ifdef>}}}   

                {{{<ifdef code="ca_objects.arch_draw_title_block.arch_draw_type_text"><H6>Drawing Type</H6>^ca_objects.arch_draw_title_block.arch_draw_type_text<br/></ifdef>}}}

                {{{<ifdef code="ca_objects.primary_designer.primary_designer_text"><H6>Primary Attribution</H6>^ca_objects.arch_draw_title_block.primary_designer_text<br/></ifdef>}}} <--Fails

                {{{<ifdef code="ca_objects.arch_draw_title_block.secondary_creator"><H6>Secondary Attribution</H6>^ca_objects.arch_draw_title_block.secondary_creator_text<br/></ifdef>}}}   <--- Fails

                {{{<ifdef code="ca_objects.unitdate"><H6>Date</H6>^ca_objects.unitdate<br/></ifdef>}}}

                {{{<ifdef code="ca_objects.medium"><H6>Medium</H6>^ca_objects.medium<br/></ifdef>}}}   

                {{{<ifdef code="ca_objects.arch_scale.arch_draw_scale"><H6>Scale</H6>^ca_objects.arch_scale.arch_draw_scale<br/></ifdef>}}}   

    Mark

    3351 x 1105 - 780K
    968 x 1662 - 333K
  • The documentation says: Entity value. Searches the CollectiveAccess entity authority for given text and creates a typeless pseudo-relationship with the selected entity.

    In the code {{{<ifdef code="ca_objects.arch_draw_title_block.primary_designer_text"><H6>Primary Attribution</H6>^ca_objects.arch_draw_title_block.primary_designer_text<br/></ifdef>}}} the attached image from the Pawtucket display does show the header "Primary Attribution". So the ca_objects.arch_draw_title_block.primary_designer_text is recognized but then does not pull the entities data.

    Is maybe something wrong with the pseudo-relationship? It shows on the Providence screen, so it exists, but it is not getting through to the Pawtucket display.

    1508 x 1047 - 397K
  • It's possible this is a bug. There were issues in the last with these "authority" elements (entity, place, occurrence, etc.). What version, exactly, are you running? Is is a release? Or something you grabbed from GitHub?

  • Hi, Seth,

    We are running CA 1.7.9 release and Pawtucket 2 release. After you helped me understand the difference between the release versions and the Git files, I stopped going to GitHub.

    I sure hope this bug is something that can be corrected relatively easily. I did check and see that the psedoelement in Providence is set as a number, not a text, which I think means it is a reference to a column in the entities table. So the lookup is failing in the Pawtucket code, apparently. But that is just me guessing.

    Thank you for your help,

    Mark

  • I'll check the 1.7.9 code for this tomorrow. It was supposed to have been corrected (and is in 1.8), but perhaps we've screwed something up. (Quite likely :-/)

  • It's a probably with 1.7 code. I've just pushed a fix for this Pawtucket2 master. https://github.com/collectiveaccess/pawtucket2

    Please give it a try and let me know how it works for you. The tag would be ^ca_objects.arch_draw_title_block.primary_designer_text.preferred_labels

    Just using ^ca_objects.arch_draw_title_block.primary_designer_text will return the entity_id of the related entity.

  • YES! Thank you, Seth! However, the addition of the .preferred_labels was not necessary. The entity label expresses from the primary_designer_text alone. A huge support to our project to get that fix. 10,000 bows of deep appreciation 😀

Sign In or Register to comment.