Hi Dan,
Thank you for this hint. I've used +p and +title so much that I had
forgotten about the +: syntax for data fields. The fi condition now works
as expected (and by the way, users are assigning priorities, so a page can
have more than one priority, but I just want to now if there is at least
one person who gave it priority A, hence the inlist).
For the sorting, however, I cannot make it work. Here is another example
where I am trying to have a page with users birthdays... I trid to do
[(search group=member.* if="set {+:birthdateday} && set {+:birthdatemonth}
&& set {+:birthdateyear}"
sort={+:birthdatemonth},{+:birthdateday},{+:birthdateyear} type=-{zones}
fmt="{+:birthdateday}/{+:birthdatemonth} [[{+p}|+]] ({+:birthdateyear})"
count=false)]
but then the results are:
04/08 Eloise Beranger (1983)
21/12 Lucian Sholva (1993)
14/12 James Faith (1991)
07/07 Wanda Venbi (1997)
... Wanda should come before Eloise and Lucian at the end...
I also tried to write sort='{+:birthdatemonth} {+:birthdateday}
{+:birthdateyear}' but the result is the same. I can't find anything on
Boltwire's website that could solve this issue. Any idea?
Thanks in advance,
Tiffany
Le mercredi 8 octobre 2014 00:19:25 UTC+2, Dan a écrit :
>
> Tiffany, to retrieve a data variable, you use {:field}. In a template, it
> should be {+:field}. In your example {+priority} will return null which is
> why the condition fails.
>
> Data values would need to be stored on each page in the search result for
> this to work of course.
>
> If you had a priority info page, you could store all your priority values
> on one page keyed to the page name--and you would use {+::field}. This
> speeds up the processing considerably as BoltWire only has to do one file
> read. Unless you are using titles or something which requires a file read
> anyway.
>
> I'm curious why you are using inlist. If the priority data value is
> something like "A,C,F" and you want to see if 'A' is in the list, your
> syntax would be correct. If you wanted to see if the data value was set to
> A or C or F, you would use if='equal {+:priority} A'.
>
> Cheers,
> Dan
>
>
> On Tue, Oct 7, 2014 at 1:12 PM, Tiffany Grenier <[email protected]
> <javascript:>> wrote:
>
>> Well, I assigned a priority data field to some pages, and I wanted to
>> display only the one with priority A. Somewhere else, I want to show them
>> all but sort them per priority. The priority is not part of the page
>> hierarchy because I use the hierarchy to reflect something else, like the
>> category.
>> I tried to do, without success, the following (nothing is returned):
>> [(search group={p}.* if='inlist list={+priority} item="A"' count=false
>> type=-{zones})]
>> I managed to achieve the first part of my result with:
>> [(search group={p}.* template=subpageslistA count=false type=-{zones})]
>> /*
>> [[#subpageslistA]]
>> [(template each)][if inlist list={+priority} item="A"]<(breadcrumb "{+p}"
>> name=link offset={p0} separator=' >> ')>[if]
>> [[#endsubpageslistA]]
>> */
>> But the sorting won't work, and I think it processes things similarly to
>> the if.
>>
>> Cheers,
>> Tiffany
>>
>> Le mardi 7 octobre 2014 16:16:22 UTC+2, Dan a écrit :
>>>
>>> The if parameter works differently in list and search functions, than
>>> any other function. In most functions, the value is processed as based on
>>> the current page and determines whether or not the process is called.
>>>
>>> In list and search, the if function is run on each item in the report to
>>> determine whether or not it is included in the report. You can use
>>> {+field}, {+value}, {+p}, {+p0}, {+title}, etc. Normal vars (like {p} and
>>> the rest are processed before the function is ever called and refer to the
>>> page you are on. So you can do if='equal {+p2} {p2}' and it will work as
>>> expected.
>>>
>>> In my tests, seems to be working. If something isn't, just let me
>>> know--I can look into it a bit more. But as you have already discovered,
>>> there's often more than one way to do things in BoltWire. :)
>>>
>>> Cheers,
>>> Dan
>>>
>>>
>>>
>>> On Mon, Oct 6, 2014 at 1:04 PM, Tiffany Grenier <[email protected]>
>>> wrote:
>>>
>>>> Perfect :-)
>>>> Also, as this may interest someone looking for solutions related to the
>>>> pulldown menu, I was trying to do some filtering on the data variables of
>>>> the result, but it seems that they are not replaced in the the if clause.
>>>> If I put the if inside the template, however, it works great.
>>>>
>>>> Cheers,
>>>> Tiffany
>>>>
>>>> Le lundi 6 octobre 2014 14:59:04 UTC+2, Dan a écrit :
>>>>>
>>>>> I was having a similar problem the other day and finally figured out
>>>>> the reason and a workaround. I actually added a couple paragraphs to the
>>>>> documentation on this issue at
>>>>>
>>>>> http://www.boltwire.com/index.php?p=docs.handbook.forms.input_select
>>>>>
>>>>> Look for the section on templates. Basically it has to do with the
>>>>> order of processing.
>>>>>
>>>>> This morning I went back and looked at the code to find a better
>>>>> solution, and discovered there was something already there--it just
>>>>> wasn't
>>>>> working right. So I changed lines 326 and 327 in library.php to these and
>>>>> it now allows fmts to have {+title}:
>>>>>
>>>>> $out = preg_replace('/\{\+([^:{}+=*]+)\}/e', "BOLTvars('$page:$1')",
>>>>> $out); // template replacements $out =
>>>>> preg_replace('/\{\+:?([^{}+=*]+)\}/e',
>>>>> "BOLTvars('$page:$1')", $out); // nested template replacements
>>>>>
>>>>> Also a more serious problem. I had commented out line 415 of
>>>>> library.php when I was doing some debugging in the last release and
>>>>> forgot
>>>>> to uncomment it. Please fix that while you are at it, or you will have
>>>>> problems on forms where nextpage is not explicitly set. I'm posting an
>>>>> emergency patch to 4.17.
>>>>>
>>>>> Cheers,
>>>>> Dan
>>>>>
>>>>> On Mon, Oct 6, 2014 at 5:01 AM, Tiffany Grenier <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi again :-)
>>>>>>
>>>>>> This time, I'm trying to create a form where people can select let's
>>>>>> say their best friend through a pulldown menu, and I can't make it
>>>>>> display
>>>>>> the page titles (friend pseudo).
>>>>>> I've tried to do the following, without success: [select
>>>>>> bestie][(search group=member type=-{zones} fmt='[option "{+p}"
>>>>>> "{+title}"]')][select]
>>>>>> The following works, but is not what I wanted: [select
>>>>>> bestie][(search group=member type=-{zones} fmt='[option "{+p}"
>>>>>> "{+page}"]')][select]
>>>>>> Could you please tell me what I'm doing wrong?
>>>>>>
>>>>>> Cheers,
>>>>>> Tiffany
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "BoltWire" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at http://groups.google.com/group/boltwire.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "BoltWire" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/boltwire.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "BoltWire" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/boltwire.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.