Hi, is there a possibility to convert strings (out of an inline query with smw) into numbers (if string just contains numbers) to make calculations with the {{#expr:...} function? Kai
On 31/10/2007, Vielevisels kaivi@arcor.de wrote:
Hi, is there a possibility to convert strings (out of an inline query with smw) into numbers (if string just contains numbers) to make calculations with the {{#expr:...} function? Kai
Parser functions can only take strings as input, since wikitext is just one big string. The function will do the conversion itself if the string is just numbers, surely. If something is going wrong, it's probably because smw is formatting the number in some strange way - see if there's an option to output the raw data, and if not, request one. Shouldn't be a difficult feature to add.
In PHP, strings and numbers are largely interchangeable, and the typing is very loose[1]. Thomas is right - if possible you should try to get the raw output to see what's going on.
[1] http://us2.php.net/manual/en/language.types.type-juggling.php
-- Jim R. Wilson (jimbojw)
On 10/31/07, Thomas Dalton thomas.dalton@gmail.com wrote:
On 31/10/2007, Vielevisels kaivi@arcor.de wrote:
Hi, is there a possibility to convert strings (out of an inline query with smw) into numbers (if string just contains numbers) to make calculations with the {{#expr:...} function? Kai
Parser functions can only take strings as input, since wikitext is just one big string. The function will do the conversion itself if the string is just numbers, surely. If something is going wrong, it's probably because smw is formatting the number in some strange way - see if there's an option to output the raw data, and if not, request one. Shouldn't be a difficult feature to add.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org