Help on nesting Custom Displays

Hi! I’m nesting custom displays following the instructions on this topic.

Everything works fine except that the second custom display is not filtered the way I expected.

Custom Display 1 ((id=3, Form1:Accounts) is ordered by Order (a number field, set manually to order the way we want the entries).

Custom Display 2 (id=4, Form2:SubAccounts) is ordered by a similar field, Order; it contains a Data from Entries field: ParentAccount, linked to AccountName of Form1. It must show all entries of ParentAccount that matches to AccountName.

This is the result I expect:

1-AccountName1 (form1-cd1)
1-SubAccountName1 (form2-cd2) – linked to AccountName1
2-SubAccountName2 (form2-cd2) – linked to AccountName1
3-SubAccountName3 (form2-cd2) – linked to AccountName1
2-AccountName2 (form1-cd1)
1-SubAccountName4 (form2-cd2) – linked to AccountName2
2-SubAccountName5 (form2-cd2) – linked to AccountName2
3-SubAccountName6 (form2-cd2) – linked to AccountName2

etc.

 

These are the steps I made (I had to “translate” it from the example of the topic):

In Custom display 1 (Accounts):

1. Set to show all entries.

2. Selected Order field to order by (asc).

3. In the content box, inserted the custom display shortcode for custom display 2:

[display-frm-data id=4 my_value=[120]]  (120 is the ID of AccountName of Form1)

4. In the advanced section of the custom display settings, added a where row for: Order is not equal to (the box left blank) – I don’t understand what is this for.

5. Custom code added in functions.php:

add_filter(‘frm_where_filter’, ‘filter_custom_display’, 10, 2);
function filter_custom_display($where, $args){
if(isset($args['display']) and $args['display']->id == 3 and $args  //3 is the top level Custom Display
['where_opt'] == 120){ //120 is the ID of AccountName
$where .= ” GROUP BY meta_value”;
}
return $where;
}

In Custom Display 2 (SubAccounts):

1. Show all entries from Form2, ordered by Order (asc)

2. Where: ParentAccount is like [get param=my_value]

 

This configuration shows the top-level entries but displays “No entries found” in the second level display.

If I remove the Where row of the second custom display, it shows top-level display entries, each followed by ALL entries of the second-level display, not filtering them by ParentAccount, of course.

Now, I observe that Custom Display 1 is sending correctly the param my_value to the second Custom Display, because I tested putting [get param=my_value] in the AfterContent section of the CD, and it shows the correct ParentAccount name for every sub-display. But whatever, the Custom Display 2 shows no entries when I add the Where row.

What can I be doing wrong?

 

What field type is ParentAccount? Does the value in that field match exactly to the value in the Account name field from form one?

It's a Data from Entries field, linked to AccountName from form1. And yes, the value matches, I tested with [get param=my_value].

Can you please attach screenshots of the field options for both of these two fields (parentAccount and AccountName)?

These are the screenshots. I tried to be as graphical as possible.


Attachments:
honcd01honcd02honcd03honcd04honcd05honcd06

Try this:
[display-frm-data id=4 my_value=[id]]

Yes, it worked now. I'm surprised that I haven't tried something as simple as that. Thanks, you're wonderful! Nesting custom displays opens up a new level for me!

Hi Stephanie, the nesting is performing ok, and I went one step further, nesting another display inside the nested custom display. It played very well, now I'm using the frm-stats shortcode with some degree of success:

Custom Display 2 (second-level above) calls Custom Display 3 (id=5, entries from form Transactions) this way:
[display-frm-data id=5 subaccount_value=[id] filter=1]

I put the shortcode inside the Custom Display 3 (third-level):
[frm-stats id=128 round=2 126=[get param=subaccount_value]]

128 is the id of the numeric field in the form "Transactions" with the values to sum. This form contains the field 126, the name of the subaccount that matches the parameter.

And that is correct, now the sum of all Transactions matching the sub-account is displaying in the sub-account line (see attached image).

Now, one more step further, I'd like to achieve the display of the total of all transactions matching every first-level line. I tried putting one more Custom Display, the number 4 (id=6, entries from form Transactions), called from the Custom Display 1 (Accounts).

The problem is that Transactions contains a Data from Entries field (SubAccount-from, id=126) linked to form SubAccounts, which has a Data from Entries (ParentAccount) field linked to form Accounts. Now I cannot read ParentAccount from Transactions to sum the entries of the field 128 only matching the ParentAccount.

I used another param calling from Custom Display 1:
[display-frm-data id=6 account_value=[id] filter=1]

And shortcode in Custom Display 4 id=6:
[frm-stats id=128 round=2 ???=[get param=account_value]]

But ??? represents the field that had to match ParentAccount, calling from I don't know.

If it's too confusing, I will elaborate a graphical view of the forms and custom display to see if you're able to help me...

This is not urgent, so I want to thank you for your infinite patience. I promise to write an article for the Knowlegde Base when I get through all this. :)


Attachment:
honcd-09

In [frm-stats id=128 round=2 ???=[get param=account_value]] you need a field ID of the field from the same form as field 128 that holds the account value.

The reason I frequently mark your posts private is because they range over a wide range of topics and are generally too specific and lengthy to be very helpful for others. This same question is repeated in the help desk in several places, but is much more concise and easy to generalize.

Ok, about the posts, I was just curious, I'll respect your decision. But if you wish, I keep my promise to write an article for the Knowledge Base to guise other users over the steps I took before to achieve this whole objective, which is a kind of table of accounts in many levels, with totals for each levels. Once I discover how to develop all the process, it may be very useful (I think). I like to think that you'll welcome this colaboration for the sake of your product. ;)

Well, about the last matter, I half got it:

As I said before, in forms Transaction (the basic form that contains the quantities to sum) I have a DfE field that links to the sub-account name in SubAccounts form. When I use frm-stats to sum, it pulls the matching field and does the trick.

When adding an entry in Transactions, user selects the "SubAccount-from" field to assign the Transaction to a SubAccount. Now, the logical step is adding another DfE field in Transactions that reads the ParentAccount from the SubAccount form and have a match for the second shortcode and obtain the parent account matching field.

Then, I added the Account-from field (Data from Entries, id=135): (see image). This field must be pulled from the DfE field of SubAccounts form. The objective is that when the user selects the sub-account for a transaction, automatically pulls the top-level account (parent account) related to that sub-account, then I'll be using this shortcode in the custom display:

[frm-stats id=128 round=2 135=[get param=account_value]]

I think this shortcode should work, 135 is in the same form (Transactions) as 128, and 135 would match the parameter.

But in the form Transactions, nothing is pulled in the 135 field. It would be non-elegant if the user had to select the sub-account and then the parent account when there is already a relationship.

So, once again (with a bit of embarrassment) what am I doing wrong?


Attachment:
honcd-10

That field (135) is set to "just show it". These fields work differently. You say this works:
[frm-stats id=128 round=2 127=[get param=subaccount_value]]

That is the way it needs to be done with the way your form is set up. What are you expecting field #135 to show when you are adding and editing entries?

Well, I already made the shortcode work the way I expected in the first level custom display this way: [frm-stats id=128 round=2 135=[get param=account_value]], but that's because I made the 135 field a DfE field pulling directly from Accounts. The problem is the user, in form Transactions, has to select twice: the sub-account and the account, and why would he need to if they are already related as sub-account-->parent account?

The expected behavior in form Transactions is the user selects the sub-account (field 126) and then the 135 field shows the related ParentAccount from the same form (SubAccounts). Later, the first level custom display passes this value as a parameter to the shortcode. That would be (I think) the final touch for the basic "Finantial system" to work ok.

Screenshot


Attachment:
honcd-11

I'm not sure what you're asking, or how selecting a sub account translates to the attached screenshot with your stats.

hi .... can i know how u made the nested fields? I have a lot of data I need to display according to categories, and it will be good to know that such a feature can be incorporated since it makes data display for more criteria possible. And to Stephanie, can such nested or categorized displays be graphed? that will be real cool and will max out implementation of formidable as a very good data presentation tool.

 

Thanks

Ok, Stephanie please let iselorm have my email or tell us a way to connect to assist him/her step by step, I know how difficult it is when you don't have a detailed guide.

And Stephanie, I think it would be nice to have a kind of message board, for users may help each other, I would gladly assist fellow Formidable users with all I have learned.

@julius, this forum can be used to communicate with other users as well. You can post here.

@iselorm, it looks like you would set the x_axis to whatever field your breaking down (135 in the example above).

Ok, I thought it will be useful to make a new topic then or a new KB topic, but whatever.

@iselorm, did you check my first post in this topic? There is a referral to another topic where Stephanie gave the directions for nesting Custom Displays, however does not cover all cases, as in mine. So please read that instructions or read my steps in the first post of this topic, and then tell me where do you get stuck, to help you there, it doesn't matter if in the beggining.

Basically, you have to identify the nested cathegories and then have the first custom display for the top-level cathegory (in my screenshots are the grey table lines). Then please return here and I will be glad to guide you.

Thanks Julius. Will do that and get back to you. Am a noob though but will try it out and let you know. Thanks for your responsiveness.

Topic closed.