Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selective ranking on differnt projects

Status
Not open for further replies.

ictoo

Programmer
Sep 3, 2009
33
GB
Hello everyone, im new to fox pro and this is my first major project.

Here is my problem.

I have a pageframe with two pages the first one has projects and the second has tasks, tasks are linked to a project, now I have a ranking system for tasks that you can make them go up and down in rankings. The way the rank is generated is by this code.

SELECT "projectlisttasks"
CALCULATE MAX(rank) TO lnRank
lnRank=(VAL(lnRank)+1)
lnRank=ALLTRIM(STR(lnRank))

Now the problem im facing is with the tasks ranking, each projects has many tasks and I want each project to have its own ranking system all (all tasks are In the same table). I thought away to do this was to add a for in there.

SELECT "projectlisttasks"
CALCULATE MAX(rank) FOR projno = projectlisttasks.projno TO lnRank
lnRank=(VAL(lnRank)+1)
lnRank=ALLTRIM(STR(lnRank))

projno in projectlist table is linked to projectlisttasks table by the index projno+PADL(rank,4,"0")

But this does not work, if anyone could give me some insight in to this i would appreciate it, and if anymore information is needed please just ask.
 
Your question is not really clear. Do you want to know the max rank per each Project and assign a new rank to the task inside this project group?

 
"But this does not work"

In what way does it not work?
* Do you get an error message?
* Does the Grid not display the records like desired?
* Does the Relation not work between the 2 tables?
* What?

I do see a possible problem with your Index expression - if I am interpreting your field types correctly.

Something named ProjNo would typically be an Integer.
And your doing a PADL() on Rank would result in a Character result.

An Integer cannot be concatenated with a Character.

If it is a problem with the Relation..
1. Ensure that the Index expression is valid
2. Ensure that the field size and/or lengths in both tables are the exact same.
3. Ensure that your SET RELATION TO expression matches the Child table's Index expression values.
4. Test the Relation in the Command Window separately to ensure that it is working - outside of the form

Good Luck,
JRB-Bldr
 
Sorry it took me so long to get back to you i had part of the week off.

I've sort of fixed the problem now i put a seek in and it is now sitting on the correct projno when the rank is being calculated.

And sorry for my bad explanation, but thanks alot for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top