⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


jonathanw

Member Since 26 Mar 2014
Offline Last Active Apr 20 2015 01:01 AM
-----

Topics I've Started

Multiple relations?

13 April 2015 - 05:26 PM

Hi,

 

I'm using groceryCRUD for file routing purposes.

My database looks like this

 

parties // just basic information about parties in the system

  id

  orgno

  name

 

flows // this table connects parties

  id

  sender (fk to parties.id)

  receiver (fk to parties.id)

  direction

 

Ie, one party in the system sends to another, in a specified direction.

 

Now, I'm trying to add enveloping to the routed files (the user is configuring one envelope per flow);

 

envelope

  id

  flow_id (fk to flows.id)

  sender

  sender_type

  receiver

  receiver_type

 

Now - here comes the problem. How the heck do I get this to work in groceryCRUD?

I wanted to get the flow name, ie "Sender -> Receiver (Direction)" which works if I do a SQL query. But can it be done with set_relation or _n_n?

I've tried so many different variations, but still doesn't get it right.

 

The most important thing is to get the flow name for the dropdown when adding new envelopes, instead of having to input a flow_id. That would of course work - but is not user friendly.

 

Any tips?