Jump to content
Server Maintenance This Week. ×

How to extract info from portal rows


The Learner

Recommended Posts

Hi,

I have a table called Books and a table called Publication.

On a layout based on Books, I have a portal based on boo_PUB_BooksId (Books::Id = boo_PUB_BooksId), where one or two publication dates are selected.

In a card window based on Books, I have a portal based on boo_BOOKS::Editor (Books::g_SelectedEditor = boo_BOOKS::Editor) that displays the nos and the titles of books from selected editors. That works fine. Except I want to add the publication date or dates in that portal. But I can’t manage to extract the dates from boo_PUB_BooksId (the portal on the Books layout). Could someone help me achieve that.

I’d like the dates to be displayed as follows:

If single date: 25 October 2023

If two dates: 25 October 2023 and 30 October 2023

Right now, the card window is displayed by means of a script and a global field that is populated from a value list.

Thanks for your help.

Edited by The Learner
Link to comment
Share on other sites

You want to add the publication dates to the editor’s portal or show the dates above the portal? Is the publication date related at all to the editor?

if you want to show the dates, either show both portals in the card or add a calc (several ways) that displays a list of publication dates above the editors portal. 

Link to comment
Share on other sites

Thank you for your response.

The publication dates are already displayed in the portal to the publication table on the main layout. l want these dates to also be displayed in the editor's portal in the card window. I don't want the publication dates above the portal, simply in each row of the portal, beside the book no and the book title.

 

Link to comment
Share on other sites

I am afraid your question is still not quite clear.

Assuming that one book can have many publications and that each publication has a single publication date, you can use a calculation field defined in the Books table as (result is Text) =

Substitute ( List ( Publications::PublicationDate ) ; ¶ ; ", " )

to display all related publications' dates as a comma separated list, with the dates formatted in your file's stored date format. 

If you want to format the dates in a custom format and/or use the word "and" instead of the last comma, then more work will be required.

 

Link to comment
Share on other sites

That’s exactly what I suggested (“add a calc (several ways)” and you said it’s not what you needed. You want the dates in the editor’s portal. That made me question your data model. 

Link to comment
Share on other sites

Just a small point of clarification:

Your title says "extract info from portal rows". That's not what my suggestion does. A portal is a layout object. My calculation works at the data level. It does not rely on a portal and will work regardless of whether there is one on the current layout or not.

OTOH, if you do have a portal, and the portal is filtered, the suggested calculation will ignore the filtering and you will see a discrepancy between the portal and the calculated result.

 

Link to comment
Share on other sites

  • 2 months later...
On 11/26/2023 at 9:04 PM, comment said:

OTOH, if you do have a portal, and the portal is filtered, the suggested calculation will ignore the filtering and you will see a discrepancy between the portal and the calculated result.

But instead of the calculated list, you could use the summary List Of living on the child side of the relation, and showing the summary field via yet another one line portal where the applied filtering is the exact same - the substitutions of the pilcrows is then made by massaging with

GetLayoutObjectAttribute ( objectName ; attributeName {; repetitionNumber ; portalRowNumber} )

....after having named the field shown in the new portal as object. Resizing this extra portal to 1 pix times 1 pix might be in order, and stowing it away in a corner seems obvious!

 

--sd

Link to comment
Share on other sites

3 hours ago, Søren Dyhr said:

Resizing this extra portal to 1 pix times 1 pix might be in order, and stowing it away in a corner seems obvious!

That's not necessary. You could simply put the portal on the margin of the layout, outside of any layout part.

However, all this added complexity is not required here, since the original portal is not filtered.

 

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.