Form fails on SMW 1.8 #ask
Closed, DeclinedPublic

Description

Author: ad.strackvanschijndel

Description:
A project form uses {{#ask: [[Category:Project]] |?Project number | format=max }} to determine the current highest project number.

The form fails - a white screen appears after a long while instead of the form to appear - when the project is edited with form.

The 'ask' showed above seems to be the cause of the problem, since the form shows promptly when it is removed from the form definition. Also the problem doesn't occur with SMW 1.7.1 in combination with SF 2.5.1.

The problem occurs with SMW 1.8 beta 2. Other versions are: MW 1.19.2, SF 2.5.1, SRF 1.8 rc2.


Version: unspecified
Severity: normal

bzimport set Reference to bz42347.
bzimport created this task.Via LegacyNov 22 2012, 7:08 AM
mkroetzsch added a comment.Via ConduitNov 22 2012, 9:15 AM

Please try the following query instead:

{{#ask: [[Category:Project]]

?Project number=
mainlabel=-
sort=Project number
order=DESC
limit=1

}}

and compare its result with the result of your original query (if you can get it at all). Please let us know if this works.

bzimport added a comment.Via ConduitNov 22 2012, 11:15 AM

ad.strackvanschijndel wrote:

Ok I did what you suggested and did some additional research. The interesting results I think are:

{{{field|Project number|default= {{#expr: {{#ask: [[Category:Project]]

  | ?Project number
  | format=max
}} + 1}}

}}}

shows '{{#expr: {{#ask:' in the project number field when creating a new project (NOK) and
works well when editing a project with the form (OK).

The original statement: {{{field|Project number|default= {{#expr: {{#ask: [[Category:Project]] | ?Project number | format=max }} + 1}} }}}
which is exactly the same, only the whole 'field' statement on one line,

shows the correct (next) project number when creating a new project (OK) and
causes the form to fail (white screen after long while) when editing the project (NOK)

mkroetzsch added a comment.Via ConduitNov 22 2012, 11:32 AM

If the query that I suggested works for you, it is highly recommended to use this query instead of format=max everywhere. Similarly for format min (but change the order to ASC there). If you want to do math with the result, you should also specify that you do not want any formatting by adding a #-:

{{#ask: [[Category:Project]]

?Project number#-=
mainlabel=-
sort=Project number
order=DESC
limit=1

}}

The max format should be avoided whenever possible. It is very resource intensive (possibly retrieving thousands of results to find one number) and may still lead to wrong results (if there are too many matches).

The other problem you mention here seem to be related to {{{field}}} but not to SMW. I don't see why there should be a connection to SMW 1.8, but maybe there were some small output changes in #ask that your code is somehow sensitive to. I am reassigning this bug to SF now.

bzimport added a comment.Via ConduitNov 22 2012, 12:42 PM

ad.strackvanschijndel wrote:

The query you suggested shows the same results - with the addition of 'search label=' or the result includes ...further results, which is hard to use in calculations.

This means the creation of a new project works fine and editing fails.

bzimport added a comment.Via ConduitDec 2 2012, 9:01 AM

ad.strackvanschijndel wrote:

My hosting provider migrated to php 5.3.19 and the problems don't appear anymore.
It seems that the problem is related to (very) old php versions and new versions of the extensions.
Since php 5.2 is not supported anymore in the next version of SMW 'unconfirmed' seems appropriate to me.

Nischayn22 added a comment.Via ConduitDec 2 2012, 2:49 PM

Marking as Invalid for now; only one person had the problem and it worked for him

Aklapper added a comment.Via ConduitDec 2 2012, 2:55 PM

Sounds more like WORKSFORME then... :)

bzimport added a comment.Via ConduitDec 2 2012, 3:39 PM

ad.strackvanschijndel wrote:

You guys can do things with the status that wouldn't even have dreamed of ;-)

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.