portal syntax unclear

26 views
Skip to first unread message

Jim Polk

unread,
Jul 9, 2012, 10:25:53 PM7/9/12
to RFM Community
Much progress since I last posted ;-)

I'm getting record data from layouts no problem now.

However, I can't seem to find the right syntax to retrieve
the record data from a portal/table.

In our rather simple database, the main layout has a portal/table on
it, pointing back to another rather simple
layout. I've tried several of the syntax examples from your
doc page at https://github.com/ginjo/rfm without much (any?)
success. Our embedded table is named "SHOT_NOTES",
Deriving from one of your examples, I tried

myRecord.portals["SHOT_NOTES"].each {|record|
puts record["Filename"]
}

but get back:

in `<main>': undefined method `SHOT_NOTES' for #<Rfm::Resultset:
0x25751d0> (NoMethodError)

I get that Rfm strips the "::" and table name off..
but I can't seem to find any syntax that works...and can't
find any documentation to provide much detail.
I prerused the source code, but it pretty much reflects the
web docs. Would you be so kind as to explain in more detail
how the syntax is structured and how to retrieve this portal
record data?

Thank you very much,
JimPolk


wbr

unread,
May 22, 2013, 1:41:49 AM5/22/13
to rfmcom...@googlegroups.com
Just stumbled across this and saw there was no reply yet.

Yes, indeed, the documentation on portal access is rather slim at the moment. The good news is that the functionality is there. You should be able to simply

my_record.portals

and get a hash of portal_name=>portal_records. The portal_name will be the table-occurrence name of the portal on the layout. You can also get the meta-data of the portal fields with resultset.portal_meta. This is assuming you have portals on the layout you are querying. If your table-occurrence names conform to ruby method-name requirements, you should also be able to get a specific portal on your layout by simply calling it from the record object.

my_record.my_portal_name

If you have an older version of Rfm, you might have to put in your query options :include_portals=>true. If you have a newer version, make sure you don't have :ignore_portals in your query options.

Hope that helps... and I hope to clean up the docs surrounding this sometime.

Reply all
Reply to author
Forward
0 new messages