Form Action Page from Data View Problems

My Members form has a General page with all of the pertinent fields from the Members table. There is a second page called Groups which lists the different Study Groups the displayed member belongs to, based on the GroupMembers table.

I was using a standard Groups form for this page, but the 5 boolean fields in the list of study groups just said “yes” or “no”. To change one at run-time, I need to click on the particular row, which opens up a form with switches (defined as _Checkbox). I need to click one of the switches, then click Save, then click Save on the main form. Way too much work.

I decided on using a Data View instead, as that works for some of my other sub-forms. I created a query which does return the correct data. It uses a parameter with ?. When testing, I modify the Where clause to use an actual guid for the member.

Here’s the part that doesn’t work: I added a parameter to the query called MemberKey (which is one of the column values), and its value is {{five.field.MembersKey}}. I made this query Live. When I run the application, nothing shows up in the Groups sub-form.

NOTE: the singular/plural in the paragraph above is deliberate. I seem to have developed a standard so tables which are named plural (Members) have a plural key (MembersKey) but tables that use these fields have the field defined as singular (MemberKey). Don’t know how smart this is, but it seems to keep things clear.

I’m successfully using this technique in my SetupReports form. In that form, the query depends on the active user’s GUID. In that case, I run a function at startup that loads the active user’s GUID into a variable called UserKey. So that query’s parameter value is {{five.variable.UserKey}}. This one works fine.

I’m wondering if the parameter value for the query is wrong, and perhaps {{five.field.MembersKey}} does not work??? The field MembersKey is present on the general page. Also, running with inspector shows the MembersKey value in several different sections under Variables. It shows under the field, form, stack and metadata sections.

Is it possible to figure out what I’m missing?
I can’t even upload the fdf file, because it’s now too big:
image

How do I get around the “file too big” error when trying to upload fdf file? I’m sure my application is only going to grow in size. If you can’t solve this last issue, I could instead save the file to Droplr, and instead include a link to the file.

Thanks…

UPDATE: It seems to work if I create a variable with the MembersKey during a function triggered by On Show. If I then use {{five.variable.MemberKey}} in the query parameter, it works fine. Is this the way it must be done, or is there a way to do it from the field collection?

Hello,

Glad you figured it out. The best method would most likely be to set a variable and then use that variable. Using five.field on a query is not a viable method, however, there are other ways. In the past, I have made use of five.stack in order to retrieve a key.

By opening the google console within a five application, and then typing ‘five’ and pressing enter, you are able to see all the current stored variables.

Summary: In your case, using set variable would be the most efficient way so I would stay with that.

Thanks,
Riley.

Thanks Riley, this was helpful. I am not experienced as a web programmer, so I know nothing about google console. My entire programming career has been in client-server programming.

The only downside of using the variable is that I need to set it, then it goes stale when I’m done with the form. Also, I’m not sure of the lifetime / scope of the variable with regard to the particular member I select from the list. Does the On Show event fire each time I choose a record from the list? If so, then that is the right place. If it only fires the first time, then I can’t use it for when I choose a different member to display, right?

So if I have a variable called ActiveMember for example, I have to set that from the On Show event. Since I’m already doing something else at On Show time, I had to hijack the other function and put the variable assignment there at the beginning of the other process that is done on show. No worries, I guess. I was going to ask if variables had scope during server-side DO functions. In this case, we are using it just for a parameter, so that is not a major thing, but in case I do need to rely on variables in a server-side function, could you answer that anyway?

In case I decide to try stack for this query parameter, would I enter the parameter value as {{five.stack.VariableName}}?

Thanks again…

My general page is for members, and my Groups page is showing the data view, which shows group name, then 5 boolean fields, then paid date then check number.

my aim is to see each group that the member is part of, and on the group line I see the 5 booleans displayed as X or checkmark. That is how the checkbox field seems to render on the data view. I want to click each boolean and have it flip from X to Checkmark and vice-versa. If I add a click event to a data view field, it should work to flip the value of that field.

This has worked before in other data view driven subforms. In the other case, I only had a name field and a IsSelected field. When I gave the name field a click event, it would look and act like a button.

In this form, I am not clicking the name field, I am clicking the checkbox/boolean field next to the name. That would cause a function to run which would flip the value of that particular boolean field. Unfortunately, when I setup an on click event for the data view field, the entire field disappears. While it used to look like:

Group Name X X X X X

it now looks like:

Group Name X X X X (with extra space instead of the first X)

So the question is: How can I make the data view responsive to clicking any of the boolean fields (either X or checkmark) to flip that value?

And the next question is, is it possible to be able to edit the 2 text fields at the end of the data view record directly in the data view without opening up another form?

Thanks…

Instead of a Data View, I’m trying a Grid page, using the GroupMembers form. My intent is to use this technique in a Members form page and a StudyGroups form page. It seems to work except for the extra fields being displayed.

In the Members form it shows a list of groups for that member. GroupKey GUID field (with _lookupUnique) properly displays group name. But MemberKey field still displays as GUID.

In the StudyGroups form, it also works with a list of members for that group. It shows member name, but GroupKey GUID is also showing.

I need to make those GUID fields hidden. I put =(five.actionID()===“Members”) in the show-if for the StudyGroupKey field, and =(five.actionID()===“StudyGroups”) in the show-if for the MemberKey field, hoping that would make those fields hidden depending on main page form. This did not work. What did I do wrong?

The list of Member names in the StudyGroups form is not alphabetical.
The list of StudyGroup names in the Members form is not alphabetical.
How can the list in the sub-form be sorted alphabetically by default?

The various columns in the grid are too wide. I realize they can be resized on the display, but I would like to give them realistic widths by default. I tried modifying the GroupMembers form fields in the Display tab, using different numbers for widths, but that didn’t help. How do I fix this?

Can you help me by answering the bold questions? Thanks…

Hello,

Regarding the scope of a set variable, the variable can be use within a server side DO function. The variable also maintains it’s value for the entire run time of your application, or until it’s value is changed.

Regarding the query parameter using stack, I know you said you are unsure of google console, but one way to obtain the stack values is by using the google console.

First, go to the page where you plan on using the stack parameter (I am assuming this will be where you run the query).

Second, right click, and press inspect (provided you are using google chrome).

Third, click console.

Fourth, type five.stack and press enter.

In the example I have provided, to access the value, I would need to use:
five.stack.Distributor.DistributorKey

Hope this helps, let me know if there is any issues with the google console!

Thanks,
Riley.

Hello,

Regarding the show if fields, are you able to just set these to false? If not, you may need to send the FDF with some directions so I can see if there is a different way to solve this issue.

Regarding a list within a subform, the order in which records are presented unfortunately cannot be changed. These records will only appear in the order that they are added, however, you are able to adjust the order within the header.

Unfortunately, you are unable to adjust the width of grid columns before run time, however, this is a feature in which will be brought up within our next product review meeting!

Thanks,
Riley.

Thanks Riley, I will try using the google console.
Meanwhile, using the show-if formulas I mentioned above causes the following error when I click on a grid line to edit it: Cannot read properties of null (reading ‘formKey’). Removing those show-if formulas lets the application run again. Can you suggest a formula which will work to hide the fields I don’t need depending on the parent form?

Thanks for the newest answer. Our replies crossed in the mail.
I did your suggestion regarding the console. I typed “five.stack” in the Filter input, I hope that’s where you meant to type it. Didn’t find anything. Was I supposed to have run the application using the inspector? If I did that, I would not need the console, right?

Since the sub-form (GroupMembers) will be used in the Members form and also the StudyGroups form, I can’t just make the 2 pertinent fields false in the show-if box. I need to hide one or the other depending on which parent form is active at the moment. Why would I want to see study group GUIDs in the list if I’m working in the study groups form? Ditto for the Members form.

I can live with the wide columns in the grid, i suppose. But not the un-sorted list details. Is it possible to use a live query as the GroupMembers form’s data source the way I can do with a data view? There must be a way to solve this…

Hello,

Regarding your first reply, could you please send me your latest FDF and I will take a look into this. One method I’d suggest is that when clicking into the subform, set a variable to be false, then set the show if to the value of that variable.

And yes, you could actually attach a function in which uses five.log(five.stack) in order to log the stack within the console. You may also to do five.log(JSON.stringify(five.stack)).

Also I will take a look and see if there is a way to sort the list somehow and get back to you on that.

Thanks,
Riley.

Last time I tried to send an FDF file it wouldn’t work, saying the file exceeded the 8mb limit. my fdf file is 8.9 mb I believe. Can you tell me how to get around that? I have a Droplr account, which I can save the file to, and include a link to the file in my reply. Will that work?

I notice when I run using inspector and showing the Members form, the Variables > variable section only shows the UserKey variable I define at log-in time. It doesn’t show the 2 or 3 variables I define when the form’s on-show event fires. I did notice the following however:


When I’m running the StudyGroups form, the keyName is “StudyGroups.StudyGroupsKey”. I tried this in a show-if formula for the MemberKey variable: =!five.stack.keyName.startsWith(“Members”), which also didn’t work. Also tried =not(five.stack.keyName.startsWith(“Members”)), which also didn’t work.

If we can’t get this part to run properly, I could go back to a data view, which can be sorted properly. Is there a way, if I define a field with an on-click event (which causes it to appear like a button) is there a way to pop-up another form (the group members form with that detail record showing) without replacing the entire current form? If it does replace the entire form, is there a way to go back to the original form once I click save or cancel on the pop-up form? On a query-based data view, I can sort and also adjust column widths.

I would have to open a popup form filtered to that particular member-group combination, then when done come back to the original form with the same member still selected in the general page.

Hello,

For this question I will most likely need to take a look into your FDF.

I am not too familiar with Droplr but upload it to there and send me the link and I will see if I can access it. If not, I’m sure we can find another way,

Thanks,
Riley.

Hi Riley,
Here is a Droplr link. It will expire in 24 hours. Can you please try to use it and let me know if it worked?

I think, if there is a way to open a form with a particular record showing, then come back to the first form with the same record showing, that should work. Using a data view with a live query behind it is a pretty good way to sort the way I want, and also control the column width. In the data view, I can make the Group into a button, which when clicked, opens up a data form for the Group Members table. We have the GroupMembersKey field there for reference. When we come back, we can open the Members (or StudyGroups) form using the original actionID, and hopefully navigate to the same record that was up originally.

Thanks for working on this.

Hello,

Sorry, I am too late to access the Droplr link, would you be able to send it again when you have chance, I will be monitor the forum for your reply,

Thanks,
Riley.

Hi Riley,

Here is a new link.

I hope you can download and open the file. I think my fdf file got too big because I just recently deleted the members and groups data and imported it from my Access application, which has almost 1,000 members and 75 or so groups.

Please look at the StudyGroups form, which currently has a grid page for members. I’m currently getting an error if I click on a member in the grid, which says “Cannot read properties of null (reading ‘formKey’)”.

I can use a data view instead, where I can sort members properly and define column widths. This would require having a button click event open the GroupMembers form with the proper item selected, then when I save the changes, go back to the StudyGroups form with the same StudyGroup selected.

Alternatively, if you can figure out a way to use the grid, avoid the error mentioned and allow sorting and column width defaults, that would work too. Thanks…

Hello,

Just letting you know, I was able to download your FDF and am taking a look into it now.

Another thought I had, if the data you have deleted from your app is not important, you are able to turn off ‘Enable Versioning’ which should significantly reduce the size of your FDF if there is a lot of deleted data.

Thanks,
Riley.

Hello,

Regarding the importance of ordering the grid, I remember you previously mentioning that this is a crucial requirement for your application. There is currently no way to order the grid given it is a subform, so in that case, I would recommend the use of a Data View.

I am happy to still take a look into the grid issue if you are still wanting to make use of the grid, however, please let me know if you encounter any issues when using a data view if you go with that option instead.

Thanks,
Riley.

The data view works perfectly for display purposes. However, I have no idea what to do when I want to make changes. There are 7 or so fields that may need to be modified on each record. As I asked before, is it possible to open a form for editing?

Thanks…

Ron Mittelman

I think I found how to go to another form, and supply key value to load record.

five.selectAction('GroupMembers',five.field.StudyGroupMembersKey)

Then I can use previousAction to come back.
Where would I code the previousAction command? Would it be onComplete for the form I am editing? Since I am coming from the Members form, before using SelectAction, wouldn’t I need to first save the current member key for when I return, right?

This next part is just an annoyance: The GroupMembers form, based on the StudyGroupMembers table, doesn’t show a group name or member name. I need this, but those fields are not part of the table. I tried defining a GroupName field (without field ID of course) as a _lookup type field. It then shows a drop-down to choose a record. Do not want a drop-down. How do I define a form field to automatically look up the group name from the StudyGroups table given the StudyGroupKey GUID field I do have?

If you could answer the bold questions, I think I could continue.

Sorry to be such a complainer, but the lack of documentation and a full object model is causing a lot of time loss.

Thanks…