From: Vezina, J. <Jam...@nr...> - 2013-05-31 20:03:58
|
Thanks, but I'm just not getting it. In my overall page template, I have <pre> {{Food ...snip... }} {{#subobject:FavoriteFruit | myFruit | whyFav }} </pre> Then in my FavoriteFood template (for the actual subobject) <pre> {{#subobject : | myFruit={{{myFruit|}}} | whyFav={{{whyFav|}}} }} </pre> Edit the page to see the template text. </noinclude><includeonly>{| class="wikitable" ! Fruit | [[MyFruit::{{{myFruit|}}}]] | [[WhyFav::{{{whyFav|}}}]] |} </includeonly> So if I go to the overall page, each subobject appears in its own table at the bottom. But if I do the following ASK query, it combines all column values (so if I have two subjects with the same value, the result just shows one in that column). {{#ask: [[{{FULLPAGENAME}}]] |?myFruit |?whyFav |format=table |mainlabel=-}} It feels like I'm really close (with your help) but just don't have it exactly right. Thanks for helping me make this work. Jim -----Original Message----- From: Ad Strack van Schijndel [mailto:ad....@gm...] Sent: Friday, May 31, 2013 2:00 AM To: Vezina, James Cc: sem...@li... Subject: Re: [Semediawiki-user] subobjects - all subobjects grouped by page when retrieved with an #ask query Hi James, The secret is what you do in the {{FavoriteFruite}} template. You are talking about subobjects as if they are created on the page itself, but that is not the case. Probably you have something like [[myFruit::{{{myFruit|}}}]] [[whyFav::{{{whyFav|}}}]] in your {{FavoriteFruite}} template, and this does result in what you describe, but not in what you want. To get what you want, you should have something like {{#subobject : | myFruit={{{myFruit|}}} | whyFav={{{whyFav|}}} }} in your {{FavoriteFruite}} template. Then each instance of 'FavoriteFruit' results in a subobject, which will show as separate rows in the table when you do the 'ask'. Ad On 30 mei 2013, at 19:13, "Vezina, James" <Jam...@nr...> wrote: > Hello, > > For one of my pages, I need to add a variable number of sets of data and subobjects look like exactly what I need. But the problem is when I display them, it groups all the subobject data together by value rather than keeping them as separate rows. > > Within my form (along with all the rest of the data), I have {{{for > template|FavoriteFruit|multiple}}} > '''fruit''' {{{field|myFruit|mandatory|input type=string}}} > '''why''' {{{field|whyFav|mandatory|input type=string}}} > {{{end template}}} > > That works perfectly. I get a button to add as many FavoriteFruits as I'd like. Each time I click the ADD button, I get a little form to fill out. Then the subobject portion of a resulting page looks pretty good to me - the following appears below the rest of the data for the page: > {{FavoriteFruit > |myFruit=apple > |whyFav=it is red > }} > {{FavoriteFruit > |myFruit=apple > |whyFav=has a nice crunch > }} > {{FavoriteFruit > |myFruit=orange > |whyFav=the color and name are the same > }} > > I create a template just for this subobject and the data gets displayed at the bottom of the page, one at a time. So far just as I'd expect. > > However, I need to display the data elsewhere, so I use the following #ask query to display the results: > {{#ask: [[{{FULLPAGENAME}}]] |?myFruit |?whyFav > |format=table|mainlabel=-}} > > The result I get is one row with two columns. The first column has: > apple, orange And then another column with: it is red, has a nice > crunch, the color and name are the same > > What I was expected to get was three rows. > > Thanks in advance for your help, > Jim > > PS I hope the "formatting" works and makes it readable. > ---------------------------------------------------------------------- > -------- Introducing AppDynamics Lite, a free troubleshooting tool for > Java/.NET Get 100% visibility into your production application - at no > cost. > Code-level diagnostics for performance bottlenecks with <2% overhead > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap1 > _______________________________________________ > Semediawiki-user mailing list > Sem...@li... > https://lists.sourceforge.net/lists/listinfo/semediawiki-user |