dynamic list of [[allows value]] on property page

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

dynamic list of [[allows value]] on property page

Dade Christian
Hello,

I would like to have a dynamic list of [[Allows value::...]] on the property page. The list of values should be derived out of the used values on a given category. Scenario:

Page1 sets [[att::val1]]

Page2 sets [[att::val2]]

Property page att should have
[[allows value::val1]]
[[allows value::val2]]

Forms should restrict the values of att to val1 and val2. This should work on all values that are assigned on all pages (of a given category).

I tried to use a {{#ask:...}} on the property page using a template to generate the layout (like [[allows value::{{{2}}}]]). This is not working.

Any hints? Thank you in advance!

Best regards

Christian

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: dynamic list of [[allows value]] on property page

Dade Christian
Hello,

how to query on empty values? I would like to find all pages, where a given attribute is not set. Like:

{{#ask:[[Category:My pages]] [[Attribute::”NULL”]]
| ?Attribute
}}

This is not working:

{{#ask:[[Category:My pages]] ![[Attribute::+]]
| ?Attribute
}}

Any hint?

Best regards

Christian



------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

calculated columns with #ask:?

Dade Christian
Hello,

is there a way to add a calculated column to an ask-query. Like:

{{#ask:[[]] :[[Category:My pages]]
| ?Attribute
| ?{{#len:Attribute}}=length of Attribute
}}

Or do I have to set the calculated value to a new variable on each page?

Best regards

Christian

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: dynamic list of [[allows value]] on property page

Yaron Koren-2
In reply to this post by Dade Christian
Hi Christian,

That definitely won't work - you can't set the allowed values based on what
values have been used, because if values aren't allowed yet, they can't be
used, i.e. won't be stored - there's some circular logic there.

Unless you mean that you want to "fix" the set of allowed values at a
certain point in time, and never change it again. That might be possible in
theory, but it seems like a hack.

If you just want to restrict the set of values in the form, you can just do
"input type=dropdown|values from property=att". Or use one of the other
input types, like "radiobutton".

Or is the issue that the property "att" is used in more than one category,
and you want to restrict the set of values to just those used in one of
those categories? If so, then your attempted solution definitely wouldn't
work... but if you want to do that, the best solution for now is probably
just to use different property names in the different categories, so that
you can much more easily isolate the values for each category.

-Yaron
On Mon, Apr 16, 2012 at 3:41 AM, Dade Christian <
[hidden email]> wrote:

> Hello,
>
> I would like to have a dynamic list of [[Allows value::...]] on the
> property page. The list of values should be derived out of the used values
> on a given category. Scenario:
>
> Page1 sets [[att::val1]]
>
> Page2 sets [[att::val2]]
>
> Property page att should have
> [[allows value::val1]]
> [[allows value::val2]]
>
> Forms should restrict the values of att to val1 and val2. This should work
> on all values that are assigned on all pages (of a given category).
>
> I tried to use a {{#ask:...}} on the property page using a template to
> generate the layout (like [[allows value::{{{2}}}]]). This is not working.
>
> Any hints? Thank you in advance!
>
> Best regards
>
> Christian
>
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>



--
WikiWorks · MediaWiki Consulting · http://wikiworks.com
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: dynamic list of [[allows value]] on property page

Martin Renvoize
Christian,

What's the purpose of the "Allows value" in your request?  I might be
mis-interpreting your question, but it sounds to me like maybe what your
after is the auto-completion capabilities that Yaron has already got in
semantic forms?  Might be worth a quick read through the relevant section
of the wiki:
https://www.mediawiki.org/wiki/Extension:Semantic_Forms/Defining_forms#Autocompletion


It's an excellent feature, helping to suggest to users what property value
already exist, but allowing them to add further values if none match what
they are looking for?

Martin

On 16 April 2012 15:43, Yaron Koren <[hidden email]> wrote:

> Hi Christian,
>
> That definitely won't work - you can't set the allowed values based on what
> values have been used, because if values aren't allowed yet, they can't be
> used, i.e. won't be stored - there's some circular logic there.
>
> Unless you mean that you want to "fix" the set of allowed values at a
> certain point in time, and never change it again. That might be possible in
> theory, but it seems like a hack.
>
> If you just want to restrict the set of values in the form, you can just do
> "input type=dropdown|values from property=att". Or use one of the other
> input types, like "radiobutton".
>
> Or is the issue that the property "att" is used in more than one category,
> and you want to restrict the set of values to just those used in one of
> those categories? If so, then your attempted solution definitely wouldn't
> work... but if you want to do that, the best solution for now is probably
> just to use different property names in the different categories, so that
> you can much more easily isolate the values for each category.
>
> -Yaron
> On Mon, Apr 16, 2012 at 3:41 AM, Dade Christian <
> [hidden email]> wrote:
>
> > Hello,
> >
> > I would like to have a dynamic list of [[Allows value::...]] on the
> > property page. The list of values should be derived out of the used
> values
> > on a given category. Scenario:
> >
> > Page1 sets [[att::val1]]
> >
> > Page2 sets [[att::val2]]
> >
> > Property page att should have
> > [[allows value::val1]]
> > [[allows value::val2]]
> >
> > Forms should restrict the values of att to val1 and val2. This should
> work
> > on all values that are assigned on all pages (of a given category).
> >
> > I tried to use a {{#ask:...}} on the property page using a template to
> > generate the layout (like [[allows value::{{{2}}}]]). This is not
> working.
> >
> > Any hints? Thank you in advance!
> >
> > Best regards
> >
> > Christian
> >
> >
> >
> ------------------------------------------------------------------------------
> > For Developers, A Lot Can Happen In A Second.
> > Boundary is the first to Know...and Tell You.
> > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> > http://p.sf.net/sfu/Boundary-d2dvs2
> > _______________________________________________
> > Semediawiki-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >
>
>
>
> --
> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>



--
Martin Renvoize
07725985636
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: calculated columns with #ask:?

Van de Bugger
In reply to this post by Dade Christian
Hi,

Did you try it before asking? Did you face a problem?

Yes, calculated columns are possible. For example, here is piece of my
working code:

        {{  #ask:
            [[Visit:+]]
            {{  #if: {{{ participant }}}
                |   [[Is participated by::User:{{{ participant }}}]]
            }}
            {{  #if: {{{ cache }}}
                |   [[Is paid to::Cache:{{{ cache }}}]]
            }}
            {{  #if: {{{ region }}}
                |   [[Is paid to::<q> [[Cache:+]] [[Is located
in::Region:{{{ region }}}]] </q>]]
            }}
            {{  #ifeq: {{{ type }}} | updated
                |   [[Is a new page::false]]
            }}
            |   ?#                   = visit
            |   ?Happened on#ISO     = happened on
            |   ?Happened on, TZ#    = happened on, tz
            |   ?Is participated by# = is participated by
            |   ?Outcome#            = outcome
            |   ?Is paid to#         = is paid to
            |   {{  #if: {{{ date }}}
                    |   ?{{{ date }}}#ISO = date
                }}
...

Van.



On Mon, 2012-04-16 at 14:39 +0000, Dade Christian wrote:

> Hello,
>
> is there a way to add a calculated column to an ask-query. Like:
>
> {{#ask:[[]] :[[Category:My pages]]
> | ?Attribute
> | ?{{#len:Attribute}}=length of Attribute
> }}
>
> Or do I have to set the calculated value to a new variable on each page?
>
> Best regards
>
> Christian
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user



------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: calculated columns with #ask:?

Van de Bugger
> {{#ask:
> [[Visit:+]]
> {{#if:calculated column...}}
> |?fixed column...
> }}

Err… I would say you have to show more complete piece of code. By this
incomplete fragment I am not sure if it correct.

Do you have ParserFunction extension installed? Does #if function work?

My server runs MediaWiki 1.18.1, Semantic MediaWiki 1.7.1,
ParserFunctions r105459. PHP and MySQL versions do not matter I believe.
I am not sure if calculated columns work in earlier versions of MW and
SMW, but I do not see reason why not. Start your investigation with
ParserFunctions.

And please "Reply to all", not to me personally.

Van.

On Tue, 2012-04-17 at 06:38 +0000, Dade Christian wrote:

> Hi,
>
> sorry, if my question is somewhat stupid (Of course, I tried the code). I am working on SMW 1.4.0, SF 1.3.6 running on MediaWiki 1.12.0 (PHP 5.2.6, MySQL 5.0.16). I cannot change this configuration. The following/proposed syntax is not working on that installation
>
> {{#ask:
> [[Visit:+]]
> {{#if:calculated column...}}
> |?fixed column...
> }}
>
> I can change this to
>
> {{#ask:
> | [[Visit:+]]
> {{#if:calculated column...}}
> |?fixed column...
> }}
>
> what is running partly: The fixed columns are correct, the function {{#if:...}} is simply ignored (with and without a pipe; same with and without question mark). Are calculated columns a new feature and not working with my configuration?
>
> Best regards
>
> Christian
>
>
> -----Ursprüngliche Nachricht-----
> Von: Van de Bugger [mailto:[hidden email]]
> Gesendet: Montag, 16. April 2012 21:21
> An: Dade Christian
> Cc: '[hidden email]'
> Betreff: Re: [Semediawiki-user] calculated columns with #ask:?
>
> Hi,
>
> Did you try it before asking? Did you face a problem?
>
> Yes, calculated columns are possible. For example, here is piece of my
> working code:
>
>         {{  #ask:
>             [[Visit:+]]
>             {{  #if: {{{ participant }}}
>                 |   [[Is participated by::User:{{{ participant }}}]]
>             }}
>             {{  #if: {{{ cache }}}
>                 |   [[Is paid to::Cache:{{{ cache }}}]]
>             }}
>             {{  #if: {{{ region }}}
>                 |   [[Is paid to::<q> [[Cache:+]] [[Is located
> in::Region:{{{ region }}}]] </q>]]
>             }}
>             {{  #ifeq: {{{ type }}} | updated
>                 |   [[Is a new page::false]]
>             }}
>             |   ?#                   = visit
>             |   ?Happened on#ISO     = happened on
>             |   ?Happened on, TZ#    = happened on, tz
>             |   ?Is participated by# = is participated by
>             |   ?Outcome#            = outcome
>             |   ?Is paid to#         = is paid to
>             |   {{  #if: {{{ date }}}
>                     |   ?{{{ date }}}#ISO = date
>                 }}
> ...
>
> Van.
>
>
>
> On Mon, 2012-04-16 at 14:39 +0000, Dade Christian wrote:
> > Hello,
> >
> > is there a way to add a calculated column to an ask-query. Like:
> >
> > {{#ask:[[]] :[[Category:My pages]]
> > | ?Attribute
> > | ?{{#len:Attribute}}=length of Attribute
> > }}
> >
> > Or do I have to set the calculated value to a new variable on each page?
> >
> > Best regards
> >
> > Christian
> >
> > ------------------------------------------------------------------------------
> > For Developers, A Lot Can Happen In A Second.
> > Boundary is the first to Know...and Tell You.
> > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> > http://p.sf.net/sfu/Boundary-d2dvs2
> > _______________________________________________
> > Semediawiki-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>
>



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: calculated columns with #ask:?

Dade Christian
Hi,

ParserFunctions (v1.1.1) are installed. Functions work within the query, i.e. when I use them as label. So this is working and would bring a table with "4" as label for column "SAP Contact"

{{#ask:
| [[SAP Objecttype::Hierarchie]]
| ?SAP Unique Name =Unique Name
| ?SAP Contact={{#len:blub}}
}}

This is running as well without error, but would bring no extra column (Result table has two columns). There should be an extra column "Length of blub", all cells filled with "4" (not very interesting, but calculated)

{{#ask:
| [[SAP Objecttype::Hierarchie]]
| ?SAP Unique Name =Unique Name
| ?SAP Contact=Contact
| {{#len:blub}}=Length of blub
}}


Christian

-----Ursprüngliche Nachricht-----
Von: Van de Bugger [mailto:[hidden email]]
Gesendet: Dienstag, 17. April 2012 21:08
An: Dade Christian
Cc: [hidden email]
Betreff: Re: AW: [Semediawiki-user] calculated columns with #ask:?

> {{#ask:
> [[Visit:+]]
> {{#if:calculated column...}}
> |?fixed column...
> }}

Err… I would say you have to show more complete piece of code. By this
incomplete fragment I am not sure if it correct.

Do you have ParserFunction extension installed? Does #if function work?

My server runs MediaWiki 1.18.1, Semantic MediaWiki 1.7.1,
ParserFunctions r105459. PHP and MySQL versions do not matter I believe.
I am not sure if calculated columns work in earlier versions of MW and
SMW, but I do not see reason why not. Start your investigation with
ParserFunctions.

And please "Reply to all", not to me personally.

Van.

On Tue, 2012-04-17 at 06:38 +0000, Dade Christian wrote:

> Hi,
>
> sorry, if my question is somewhat stupid (Of course, I tried the code). I am working on SMW 1.4.0, SF 1.3.6 running on MediaWiki 1.12.0 (PHP 5.2.6, MySQL 5.0.16). I cannot change this configuration. The following/proposed syntax is not working on that installation
>
> {{#ask:
> [[Visit:+]]
> {{#if:calculated column...}}
> |?fixed column...
> }}
>
> I can change this to
>
> {{#ask:
> | [[Visit:+]]
> {{#if:calculated column...}}
> |?fixed column...
> }}
>
> what is running partly: The fixed columns are correct, the function {{#if:...}} is simply ignored (with and without a pipe; same with and without question mark). Are calculated columns a new feature and not working with my configuration?
>
> Best regards
>
> Christian
>
>
> -----Ursprüngliche Nachricht-----
> Von: Van de Bugger [mailto:[hidden email]]
> Gesendet: Montag, 16. April 2012 21:21
> An: Dade Christian
> Cc: '[hidden email]'
> Betreff: Re: [Semediawiki-user] calculated columns with #ask:?
>
> Hi,
>
> Did you try it before asking? Did you face a problem?
>
> Yes, calculated columns are possible. For example, here is piece of my
> working code:
>
>         {{  #ask:
>             [[Visit:+]]
>             {{  #if: {{{ participant }}}
>                 |   [[Is participated by::User:{{{ participant }}}]]
>             }}
>             {{  #if: {{{ cache }}}
>                 |   [[Is paid to::Cache:{{{ cache }}}]]
>             }}
>             {{  #if: {{{ region }}}
>                 |   [[Is paid to::<q> [[Cache:+]] [[Is located
> in::Region:{{{ region }}}]] </q>]]
>             }}
>             {{  #ifeq: {{{ type }}} | updated
>                 |   [[Is a new page::false]]
>             }}
>             |   ?#                   = visit
>             |   ?Happened on#ISO     = happened on
>             |   ?Happened on, TZ#    = happened on, tz
>             |   ?Is participated by# = is participated by
>             |   ?Outcome#            = outcome
>             |   ?Is paid to#         = is paid to
>             |   {{  #if: {{{ date }}}
>                     |   ?{{{ date }}}#ISO = date
>                 }}
> ...
>
> Van.
>
>
>
> On Mon, 2012-04-16 at 14:39 +0000, Dade Christian wrote:
> > Hello,
> >
> > is there a way to add a calculated column to an ask-query. Like:
> >
> > {{#ask:[[]] :[[Category:My pages]]
> > | ?Attribute
> > | ?{{#len:Attribute}}=length of Attribute
> > }}
> >
> > Or do I have to set the calculated value to a new variable on each page?
> >
> > Best regards
> >
> > Christian
> >
> > ------------------------------------------------------------------------------
> > For Developers, A Lot Can Happen In A Second.
> > Boundary is the first to Know...and Tell You.
> > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> > http://p.sf.net/sfu/Boundary-d2dvs2
> > _______________________________________________
> > Semediawiki-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>
>


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: calculated columns with #ask:?

Van de Bugger
On Wed, 2012-04-18 at 08:01 +0000, Dade Christian wrote:

> Hi,
>
> ParserFunctions (v1.1.1) are installed. Functions work within the query, i.e. when I use them as label. So this is working and would bring a table with "4" as label for column "SAP Contact"
>
> {{#ask:
> | [[SAP Objecttype::Hierarchie]]
> | ?SAP Unique Name =Unique Name
> | ?SAP Contact={{#len:blub}}
> }}
>
> This is running as well without error, but would bring no extra column
> (Result table has two columns). There should be an extra column
> "Length of blub", all cells filled with "4" (not very interesting, but
> calculated)
>
> {{#ask:
> | [[SAP Objecttype::Hierarchie]]
> | ?SAP Unique Name =Unique Name
> | ?SAP Contact=Contact
> | {{#len:blub}}=Length of blub
> }}
>

It seems everything work properly, but *your* expectations are totally
incorrect. You do not understand what are you doing. {{#len:blub}}
evaluates to "4", so you are executing the query:

{{#ask:
| [[SAP Objecttype::Hierarchie]]
| ?SAP Unique Name =Unique Name
| ?SAP Contact=Contact
| 4=Length of blub
}}
 
I am not sure what argument named "4" means for function #ask. It likely
is ignored. Anyway, it will not bring column named "Length of blub"
fulfilled with "4". No way.

If you add leading "?", actual query would be:

{{#ask:
| [[SAP Objecttype::Hierarchie]]
| ?SAP Unique Name =Unique Name
| ?SAP Contact=Contact
| ?4=Length of blub
}}

This queries column "Length of blub" fulfilled with value of property
named "4". I guess you do not have such property.

In my example I calculated *names of properties to request*. Using #if
(or other conditional functions, like #switch), you can choose what
properties to request:

{{#ask:
| ...
| {{ #if: Condition | ?Property1 | ?Property2 }}=Column name

or even control number of columns:

{{#ask:
| ...
| {{ #if: Condition | ?Property1=Column name }}


This works perfect and, I guess, works on your site.

You are trying to fulfill column with calculated data. #ask does not
support it directly, but you can emulate it:

{{#ask:
| ...
| format   = template
| template = YouTemplate

Instead of rendering a table, #ask will call you template for every
line, passing row data as arguments. Withing the template, you are free
to format data whatever you like (e. g. add a column with calculated
data).

Beware: Using template is hard. It is hard to predict what would be
argument 1, 2, 3, etc. (That was the reason for implementing named
arguments). There are some hidden arguments like #. Anyway, if you
cannot update your server (MW, SMW, etc) you do not have many options.
 
Good luck.
Van.


>
> Christian
>
> -----Ursprüngliche Nachricht-----
> Von: Van de Bugger [mailto:[hidden email]]
> Gesendet: Dienstag, 17. April 2012 21:08
> An: Dade Christian
> Cc: [hidden email]
> Betreff: Re: AW: [Semediawiki-user] calculated columns with #ask:?
>
> > {{#ask:
> > [[Visit:+]]
> > {{#if:calculated column...}}
> > |?fixed column...
> > }}
>
> Err… I would say you have to show more complete piece of code. By this
> incomplete fragment I am not sure if it correct.
>
> Do you have ParserFunction extension installed? Does #if function work?
>
> My server runs MediaWiki 1.18.1, Semantic MediaWiki 1.7.1,
> ParserFunctions r105459. PHP and MySQL versions do not matter I believe.
> I am not sure if calculated columns work in earlier versions of MW and
> SMW, but I do not see reason why not. Start your investigation with
> ParserFunctions.
>
> And please "Reply to all", not to me personally.
>
> Van.
>
> On Tue, 2012-04-17 at 06:38 +0000, Dade Christian wrote:
> > Hi,
> >
> > sorry, if my question is somewhat stupid (Of course, I tried the code). I am working on SMW 1.4.0, SF 1.3.6 running on MediaWiki 1.12.0 (PHP 5.2.6, MySQL 5.0.16). I cannot change this configuration. The following/proposed syntax is not working on that installation
> >
> > {{#ask:
> > [[Visit:+]]
> > {{#if:calculated column...}}
> > |?fixed column...
> > }}
> >
> > I can change this to
> >
> > {{#ask:
> > | [[Visit:+]]
> > {{#if:calculated column...}}
> > |?fixed column...
> > }}
> >
> > what is running partly: The fixed columns are correct, the function {{#if:...}} is simply ignored (with and without a pipe; same with and without question mark). Are calculated columns a new feature and not working with my configuration?
> >
> > Best regards
> >
> > Christian
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Van de Bugger [mailto:[hidden email]]
> > Gesendet: Montag, 16. April 2012 21:21
> > An: Dade Christian
> > Cc: '[hidden email]'
> > Betreff: Re: [Semediawiki-user] calculated columns with #ask:?
> >
> > Hi,
> >
> > Did you try it before asking? Did you face a problem?
> >
> > Yes, calculated columns are possible. For example, here is piece of my
> > working code:
> >
> >         {{  #ask:
> >             [[Visit:+]]
> >             {{  #if: {{{ participant }}}
> >                 |   [[Is participated by::User:{{{ participant }}}]]
> >             }}
> >             {{  #if: {{{ cache }}}
> >                 |   [[Is paid to::Cache:{{{ cache }}}]]
> >             }}
> >             {{  #if: {{{ region }}}
> >                 |   [[Is paid to::<q> [[Cache:+]] [[Is located
> > in::Region:{{{ region }}}]] </q>]]
> >             }}
> >             {{  #ifeq: {{{ type }}} | updated
> >                 |   [[Is a new page::false]]
> >             }}
> >             |   ?#                   = visit
> >             |   ?Happened on#ISO     = happened on
> >             |   ?Happened on, TZ#    = happened on, tz
> >             |   ?Is participated by# = is participated by
> >             |   ?Outcome#            = outcome
> >             |   ?Is paid to#         = is paid to
> >             |   {{  #if: {{{ date }}}
> >                     |   ?{{{ date }}}#ISO = date
> >                 }}
> > ...
> >
> > Van.
> >
> >
> >
> > On Mon, 2012-04-16 at 14:39 +0000, Dade Christian wrote:
> > > Hello,
> > >
> > > is there a way to add a calculated column to an ask-query. Like:
> > >
> > > {{#ask:[[]] :[[Category:My pages]]
> > > | ?Attribute
> > > | ?{{#len:Attribute}}=length of Attribute
> > > }}
> > >
> > > Or do I have to set the calculated value to a new variable on each page?
> > >
> > > Best regards
> > >
> > > Christian
> > >
> > > ------------------------------------------------------------------------------
> > > For Developers, A Lot Can Happen In A Second.
> > > Boundary is the first to Know...and Tell You.
> > > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> > > http://p.sf.net/sfu/Boundary-d2dvs2
> > > _______________________________________________
> > > Semediawiki-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >
> >
>
>



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: calculated columns with #ask:?

Dade Christian
Hi,

thank you very much. Everything is working fine now. One last question: Is there any more comfortable way to use calculated columns in later versions  or do you still need an extra template called for each line?

My final "hello world" on the issue "calculated columns":

--------------
Page "Test1"

{{Testtemplate
|Testattribute=val1
}}

--------------
Template "Testtemplate"

{{#set:x_Testattribute={{{Testattribute|}}}}}
[[Kategorie:Testpages]]
<!--SMW-Attribute has to have different name than the one passed from page-->

--------------
ask-Page "Testattributes List and Length"

{{#ask:
| [[Kategorie:Testpages]]
| ?x_Testattribute
| format=template
| template = Ask_Template
}}

--------------
ask-Template "Ask_Template"

Pagename: {{{1|}}}
Value of attribute: {{{2|}}}
Length of Value: {{#expr:({{#len:{{{2|}}}}}/2)-3}}
<!--named variables don't work here - use numbered-->

--------------

Different issue:
To calculate the length of the string within the second parameter (x_Testattribute) the ParserFunction #len is used. The result is somewhat different to what I would expect. Only odd numbers? #expr helps to calculate the expected value.

Christian

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: dynamic list of [[allows value]] on property page

StevenW
In reply to this post by Yaron Koren-2
Actually I have the same need.

In the most basic form I have 2 types of pages, Subjects and Articles. On the Subject page, I use a semantic query to display all the articles related to that subject. Each Article page has a property named Subject , which contains the name of the Subject page. The actually implementation is much more complicated then that, but that's the general idea.

I have a form which will be used by others for creating new article pages. The form has a field named Subject, which uses a property named Subjects (plural). Subjects is defined as follows:


Property:Subjects

 {{#ask: [[Category:Subject]]
  |format=template
  |template=AllowsValue
  |link=none
 }}


Template:AllowsValue

  
 {{#set:Allows value={{{1}}}}}


The drop down actually works, but it is not dynamic. For example, if a new Subject page is created, the Subjects drop down is not dynamically updated. In order to updated the drop down, I have to edit and save both the Subjects property and the Article form. And then the new subject appears.

Any help would be appreciated.

-- Steven
Reply | Threaded
Open this post in threaded view
|

Re: dynamic list of [[allows value]] on property page

Yury Katkov
In reply to this post by Dade Christian
Consider using 'values from category', 'values from property' or
'values from concept' when you define your semantic form. The 'values
from concept' is the most powerful. I think that [[Allows value::..]]
should only be used in easy cases.
-----
Yury Katkov



On Mon, Apr 16, 2012 at 11:41 AM, Dade Christian
<[hidden email]> wrote:

> Hello,
>
> I would like to have a dynamic list of [[Allows value::...]] on the property page. The list of values should be derived out of the used values on a given category. Scenario:
>
> Page1 sets [[att::val1]]
>
> Page2 sets [[att::val2]]
>
> Property page att should have
> [[allows value::val1]]
> [[allows value::val2]]
>
> Forms should restrict the values of att to val1 and val2. This should work on all values that are assigned on all pages (of a given category).
>
> I tried to use a {{#ask:...}} on the property page using a template to generate the layout (like [[allows value::{{{2}}}]]). This is not working.
>
> Any hints? Thank you in advance!
>
> Best regards
>
> Christian
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: dynamic list of [[allows value]] on property page

AnAlienHolakres3
Have you tried arraymap, something like this?

{{#arraymap:{{#ask: [[:+]]|link=none}}|,|x|[[Allows value::x]]}}

..on the property page..

Jakub

-----Original Message-----
From: Yury Katkov [mailto:[hidden email]]
Sent: Monday, August 20, 2012 10:36 AM
To: Dade Christian
Cc: [hidden email]
Subject: Re: [Semediawiki-user] dynamic list of [[allows value]] on property
page

Consider using 'values from category', 'values from property' or 'values
from concept' when you define your semantic form. The 'values from concept'
is the most powerful. I think that [[Allows value::..]] should only be used
in easy cases.
-----
Yury Katkov



On Mon, Apr 16, 2012 at 11:41 AM, Dade Christian
<[hidden email]> wrote:
> Hello,
>
> I would like to have a dynamic list of [[Allows value::...]] on the
property page. The list of values should be derived out of the used values
on a given category. Scenario:

>
> Page1 sets [[att::val1]]
>
> Page2 sets [[att::val2]]
>
> Property page att should have
> [[allows value::val1]]
> [[allows value::val2]]
>
> Forms should restrict the values of att to val1 and val2. This should work
on all values that are assigned on all pages (of a given category).
>
> I tried to use a {{#ask:...}} on the property page using a template to
generate the layout (like [[allows value::{{{2}}}]]). This is not working.

>
> Any hints? Thank you in advance!
>
> Best regards
>
> Christian
>
> ----------------------------------------------------------------------
> -------- For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user

----------------------------------------------------------------------------
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will
include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user