Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calc combined list of two fields

Featured Replies

Hi,

 

I am trying to pull data from a portal, for example I have Standard and Type fields.

I would like to pull that portal information into a text field that would show:

STANDARDFIELD & ": " & TYPEFIELD

STANDARDFIELD & ": " & TYPEFIELD

STANDARDFIELD & ": " & TYPEFIELD

ASTM: 12345

ASTM: 34556

ASTM: 85858

or

ASTM: 12345, ASTM: 34556, ASTM: 85858

 

Any help would be greatttt! Thanks

 

 

 

What would be the purpose of that?

  • Author

The portal is for data entry, the output to a text field would be for a detailed description with other information that can be viewed on another layout. 

Why can't you simply use a portal to view the same information on the other layout? To do what you ask for is not simple.

Quote

or

ASTM: 12345, ASTM: 34556, ASTM: 85858

The simplest way would probably be to define a calculation field in the child table =

STANDARDFIELD & ": " & TYPEFIELD 

and another calculation field in the parent table =

Substitute ( List ( Child::cCalcField ; ¶ ; ", " )

Result type should be Text in both.

 

Another option is to use the ExecuteSQL() function to get the two fields, then use Substitute to replace both the field and the record separators.

 

Or use a recursive custom function such as: http://www.briandunning.com/cf/309

 

Edited by comment

  • Author

I have a similar calc that pulls data from 2 tables, but in this situation its both from the same table. I tried just changing the values, but I am pretty noob on SQL.

 

ExecuteSQL ( "   SELECT \"Standard\", M.\"Type\"   FROM Standards C   JOIN \"Standards\" M ON     M.\"__StandardID\" = C.\"__ComplianceID\"   WHERE \"_fkParentID\" = ?   ORDER BY \"Value\" DESC   " ; "% " ; ", " ; __ChassisID )

I am at a disadvantage here, because (a) I don't know your field and table names, and (b) I have no way to test this. See if you can use this as your starting point:

ExecuteSQL( "SELECT Standard, Type FROM Standards WHERE fkParentID = ?" ; "-"; "," ; pkParentID )

 

  • Author

comment, 

Can you check this demo file? I think I blew it and forgot to mention there was a join table.

THANKS!!!!!!

Test.fmp12

Sorry, I cannot open .fmp12 files.

  • Author

Heres a screenshot of my relationships.

Screen Shot 2016-09-09 at 11.04.59 AM.png

See if this works for you (untested):

ExecuteSQL ( "SELECT Standard, Type ¶
FROM Certifications INNER JOIN Standards  ¶ 
ON Certifications.\"_fkStandardsID\" = Standards.\"__StandardsID\" ¶
WHERE Certifications.\"_fkParentID\" = ?";
 "-"; "," ; 
__ParentID )

 

Edited by comment

  • Author

Yes this works If I add "/ to the values. Thank you so much! 

Can you explain how I could add dash space at beginning and enter at end?

- ASTM: 123

- ASTM: 456

21 minutes ago, shredded said:

Can you explain how I could add dash space at beginning and enter at end?

I think you will learn how to do that by reading the help on the ExecuteSQL() function.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.