Create plan
When a user taps ‘create plan’
Then set the column values in Plans_working accordingly
And navigate to a new screen with Plans_working data
Create section
Given a user is on the create plan screen with Plans_working data
When a user taps ‘create section’
Then set the column values in Sections_working accordingly
And navigate to a new screen with Section_working data
i.e. the ability to create a plan with multiple ‘sections’.
I’ve been assuming I need to link plans_working to sections_working with a relation to do this - which I’ve done by linking a templated version of the ‘current user’ (user profile Row ID).
However I’ve noticed that when I do this, and I set up the custom action as per the screenshot below, the ‘create section’ button disappears from the display for the user. I’m not sure why?
So there is 1 row for plans_working and 1 row for sections_working. I’ve linked them with the user ID.
Maybe I’ve mis-used the relation, but I imagine it’s turning up blank because the rows are empty? My assumption was that linking them by user ID would at least let the button be visible - then when the user taps the button, Temp plan ID is set in sections_working based on the same in plans_working.
Is there a better way to link two staging tables so that, whilst creating a plan, one can create a section within that plan?
Are there any extra spaces in either one of your template columns that may be causing a mismatch for the relation?
The easier alternative, since these are single row tables, is to use a Single Value → Whole Row column instead of a relation. Then you don’t need template columns since you would be directly getting the first row from the Sections table.
If I understand this right, it’s like a form in form situation. What I usually do is set a unique ID on entry to the form, then add that ID to the child table to create a relation.
I almost always use a custom form for this, so I can create a collection of added child rows right on the custom form.
In theory there ought to be no extra spaces as the custom actions clear all values for most of the columns except DATE and Temp Plan ID. Also the staging tables, i.e. plans_working and sections_working, are linked by a templated version of the user profile ID so I guess it won’t introduce a space there.
As for the single value, that makes sense! I tried the below and got stuck however:
set up SV column in Sections_working which pulled the whole row from the Plans_working
this made the button visible again (woot!)
attempted to find a way to transfer this temporary ‘ID’ to the Sections table when the user saves the section, but it looks like SV columns don’t come up as an option when adding new rows (I guess because they’re computed columns)
@ThinhDinh correct, I’m going for a form-in-form situation
That unique ID for plans_working could presumably be row ID? I just tried changing the custom action for the button on plans_working so that it sets temp plan ID for sections_working to the row ID of plans_working, but the button didn’t appear when using that method.
Speaking of custom forms, I tried to use Darren’s custom form concept but I can’t seem to copy it - is there another tutorial somewhere on custom forms?
Wasn’t your relation created in the Plans table to link to the Sections table. I was thinking the Single Value column would be in the Plans table, because it would mimic what your relation was doing.
This is where I start to get confused. Just thinking about your original setup, it seems you now changed your approach. How is the button now showing? Did you remove the set column action?
After reading this part, it started to make sense, but now I would say, why bother linking the tables at all. If your whole goal it to get the temp ID from the Plan Table to the Section table, then you only need a Single Value column that specifically grabs that one column from the plan table instead of grabbing the whole row. You also don’t need the user specific temp ID column in the section table because you’ll already have it with the single value column.
No template columns, no relations, no whole row single value columns, and no set column action. Just create one single value column to get the temp ID from the plan table into the section table. That should be all you need.
Don’t do that. The row ID in your working tables won’t change. Great for the first plan, but subsequent plans will then have the same ID derived from the row ID which doesn’t change.
Thanks Jeff - I might not have been clear in my earlier responses, but for clarification I have the below tables:
Plans (holds all user-created plans - multiple rows)
Plans_working (working table when creating a plan - single row)
Sections (holds all user-created sections - multiple rows)
Sections_working (working table when creating a section - single row)
Hence why I can only use Single Value for plans_working and sections_working.
As my core requirement is to let the user create a plan with multiple sections, I figured I’d need to link plans_working and sections_working since ideally a user could create a section (or multiple sections) whilst they’re creating a plan.
Another thing I could do is link plans and sections_working so that in the UI the user has to create a plan first, before being able to create sections - I’m easy on the approach, but the one above seems to seem most intuitive.
Hope that clarifies! Any assistance would be most welcome
If you create a single value column in the sections-working table that gets the plan ID from the plan-working table…doesn’t that accomplish your original goal?
Yeah that gets the ‘add section’ button to appear on the screen based on plans_working data, which is a step forward
However, how might I transfer that single value column’s value to Sections when the user hits the ‘submit’ button on the screen with sections_working data? At the moment the ‘Add row’ action in the custom action creator doesn’t show the single value column as a choice…
By the way, I think the aforementioned ‘add section’ button appeared because previously I had the custom action for ‘add section’ be in this order:
set column values in sections_working, to clear all columns (based on a relation between sections_working and plans_working, linked by the templated user ID)
go to new screen with sections_working data
But now it’s in this order (i.e. the other way around):
go to new screen with sections_working data
set column values in sections_working, to clear all columns (based on a relation between sections_working and plans_working, linked by the templated user ID)
If the single value column is not showing as an option, then something isn’t configured correctly, or not as expected. I don’t seem to have any issues using a single value column with an add row action. We’ll need to see some screenshots or a video of your setup showing how you get from plan to section, how the screens are set up, and how your chilling are set up.
Ah I’ve found the issue, apologies. I forgot to change the Single Value column in sections_working to take just the temp plan ID from the plans_working column. Also I’ve now replaced the temp plan ID in plans_working so that it creates a unique ID instead of using the row ID.
I can now pick the Single Value column as an option in the custom action.
It’s weird that when I do this though, that the section doesn’t show up in the plan…as per below:
Think I’ve finally cracked it Thanks @Jeff_Hager for nudging me along!
What I did:
As mentioned, single value column should only refer to 1 column, not whole row, to make it visible in the ‘set column value’ options for the custom action
Have a simple text column, user-specific, in plans_working called ‘Plan ID’
When the user then hits ‘create plan’ on the plans screen, set the column value of ‘Plan ID’ to a unique ID (instead of generating a unique ID with a template in plans_working, as that would never change since it’s a single row table)
Set up a ‘Sections’ relation which links plans-working’s Plan ID to sections’ Plan ID
Put a custom collection in the plans_working screen with the ‘Sections’ relation (also make sure there are no filters accidentally applied on this collection)
Within the custom collection, add a collection that links the required items to sections, to show all the required information