Gossamer Forum
Home : Products : DBMan : Customization :

2 Questions - Mathematical & Output

Quote Reply
2 Questions - Mathematical & Output
I have a feild labeled "Rating" that can be from 1 to 10. However, I need to output this on a scale of 1 to 5. How do I instruct the script to divide by 2? Can it be done?

Also, could the output file be instructed to output a .WPD (Word File) rather than an HTML file?

Thanks,
=Blake Kunisch=
http://outermost.net
DBMan in Action:
http://outermost.net/mra/
http://outermost.net/dvd/
(all reviews)
Quote Reply
Re: 2 Questions - Mathematical & Output In reply to
1) Quick and dirty solution...use the following select drop-down menu in your add form codes and modify form codes:

Code:
Rating:
<select name="Rating">
<option value="1">1</option>
<option value="1">2</option>
<option value="2">3</option>
<option value="2">4</option>
<option value="3">5</option>
<option value="3">6</option>
<option value="4">7</option>
<option value="4">8</option>
<option value="5">9</option>
<option value="5">10</option>
</select>

2) Take a look at the Excel Export Mod in the Resource Center...it may provide some insights on how to export to .wpd or .doc.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: 2 Questions - Mathematical & Output In reply to
The problem is that I already have a whole database of reviews with a rating of 1 to 10, but now I am being requested to have it display 1 to 5 - hence I need the script (if possible) to divide the number by 2.

Also, I'll check the mod out - thanks for the recommendation.

=Blake=
Quote Reply
Re: 2 Questions - Mathematical & Output In reply to
I could be wrong but I think if you add coding to divide this by 2 it will not change the records that already exist in your database.

Why not just download your database into your editor and do a search and replace on your exisiting records and then rewrite the code for use with any new entries?
Quote Reply
Re: 2 Questions - Mathematical & Output In reply to
I don't want to change any records in my database - I'm just using a different display file that I need the result divided by two - so I would prefer not to do a search and replace. I just need to alter the .pl script slightly to make this adjustment just for a short while.

Thanks,
=Blake=
Quote Reply
Re: 2 Questions - Mathematical & Output In reply to
I don't know exactly how to tell you to do this but I can point you to a thread which speaks about using calculations which include division. Perhaps this will provide you with some ideas.

http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000419.html