Forum:Use of Template Parameters with Expr function

Hi there ComCentral, I've got a little bit of a dilemma here. I'm wanting to get the #expr function to read from a value elsewhere in the template, but I can't seem to get it to accept the value as a parameter. This won't do, as it has to be an input value.

The specific thing I'm trying to do is detailed below:

I'm wanting to check the values of a single number, say 2152734, and convert that to four different values. The values would be categorised as below.

I hope you get what I'm saying here, if anyone can help me out, I'd be extremely grateful. This is purely to solve the problem of templates within templates on my favorite wiki. Not everyone prefers to edit using source mode. ^ᴗ^


 * Do you have a start? If so, a link would help determine what issue you're having. Rappy 09:34, March 21, 2012 (UTC)


 * Sorry for the slow reply, yup I've just finished up on my draft of the maths here.


 * See if that works for you.  Rappy 10:21, March 21, 2012 (UTC)


 * Sorry, I'm not sure if I mentioned this before, but I'm trying to code this so that it always inputs a different number. The code you put out only renders the very first digit of a seven-digit number, rather than recoding the whole lot. Easy way to put it below.


 * 2152734 = 2, 15, 27, 34


 * 52798412 = 52, 79, 84, 12


 * It defaults to the number you used as an example. If you use  on a page, it should output those numbers instead. Rappy 10:30, March 21, 2012 (UTC)


 * I said that after testing it. This is with the knowledge that the code you put down isn't calculating properly.

See my user page and tell me if they are incorrect. Rappy 10:33, March 21, 2012 (UTC)


 * In which, they are... the platinum is correct, but the rest aren't... fixing. Rappy 10:34, March 21, 2012 (UTC)


 * This looks correct. Rappy 10:41, March 21, 2012 (UTC)


 * That looks amazing. Thank you very much! ^ᴗ^


 * * tip* Also, you might want to rename the template to something better, like . If you keep the "U" in Usage capitalized, it will need to be capitalized where ever you use it. Rappy 11:00, March 21, 2012 (UTC)