useing one field record to lacate a second field r

|
|
|
axelrad
|
|
Every time i run a certain query i will get the results - machNo Sum Weight ie m1 wt200 m2 wt400 m3 wt250............etc all i want is that an undefined field box on a form that will automatically show the sum weight value if machno is 1, similarley another undefined field box on the form that will automatically show the sum weight if machno is 2.Without any user imput. I can get the results by doing queries no problem, but for peace of mind i would like to find a way of coding the undefined field on the form as the solution to this problem. Thank you, Regards
|
|
Posted 24 years ago (Thread Starter)
|
|
| About axelrad |
|
Approved member.
Member subscribes to this thread with a verified email.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #5938, 5 replies
Thread Started 4/23/2002 12:47:00 AM
View Counter=18215
Last Reply Posted 5/17/2002 2:51:00 PM)
|
|
|
|
Location=leicester, england uk
|
|
 |
|
|
|
axelrad
|
|
THANK YOU for your replies, i was beginning to think i had missed a very simple solution TO THIS PROBLEM , your replies confirm that this may not be so. With reference to ed c, this is an extremely interesting iif statement, and one i have not come across.I am not sure what calculation you had in mind for the hidden fields to return the correct value i.e fld1 =1 and cs1 = 200, is it possible you could explain this. REGARDS
|
|
Posted 24 years ago (Thread Starter)
|
|
| About axelrad |
|
Approved member.
Member subscribes to this thread with a verified email.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #5963 (Level 1.1)
Reply to 5938
Thread Started 4/23/2002 12:05:00 PM
View Counter=2
|
|
|
|
Location=leicester, england uk
|
|
 |
|
|
|
axelrad
|
|
THANK YOU for your replies, i was beginning to think i had missed a very simple solution TO THIS PROBLEM , your replies confirm that this may not be so. With reference to ed c, this is an extremely interesting iif statement, and one i have not come across.I am not sure what calculation you had in mind for the hidden fields to return the correct value i.e fld1 =1 and cs1 = 200, is it possible you could explain this. I should have made it clear that each time the total weight query is run the sum weight will be different it is not a fixed value. REGARDS
|
|
Posted 24 years ago (Thread Starter)
|
|
| About axelrad |
|
Approved member.
Member subscribes to this thread with a verified email.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #5964 (Level 1.2)
Reply to 5938
Reply Posted 4/23/2002 12:07:00 PM
|
|
|
|
Location=leicester, england uk
|
|
 |
|
|
|
Ed C.
|
|
Create hidden (invisible) calculated fields and name them cS1, cS2, etc. Before hiding them, be sure they contain the correct calculated data in the format desired.
Calculate a visible field using the immediate if: iif(fld1="1",cS1,"Field # 1 <> 1")
|
|
Posted 24 years ago
|
|
| About Ed C. |
|
Approved member.
Member subscribes to this thread with a verified email.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #5947 (Level 1.3)
Reply to 5938
Reply Posted 4/23/2002 10:20:00 AM
|
|
|
|
Location=Colorado Springs, CO
|
|
 |
Most Recent Post
|
|
|
Ed C.
|
First if the weights are in 3 separate fields, place 3 corresponding "sum" fields on your form. 1) Sum([TableName.fldMachine1]) - name the field "SM1" 2) Sum([TableName.fldMachine2]) - name the field "SM2" 3) Sum([TableName.fldMachine3]) - name the field "SM3" Hide these fields. Set a 4th, calculated field, equal to: iif(mach#=1,"#1 total : "+string(SM1),iif(mach#=2,"#2 total : "+string(SM2),iif(mach#=3,"#3 total : "+string(SM3),"Error - whoo"))) (if get its data from one of the hidden fields above) Method 2 If you use only one field to contain a wt., and a 2nd field indicates which machine's wt. is represented in it (M1, M2 or M3) then put 2nd, 3rd & 4th copies of the table in your data model. Place table frames for each on your form - each with only the two table fields: The first indicates the machine no., the second the weight. Then create a 3rd field object "Summing" the wt. In the 2nd table frame, filter the field1 to Machine # = 1 & a corresponding sum fld will honor the filter. In the 3nd table frame, filter the field1 to Machine # = 2 & a corresponding sum fld will honor the filter. In the 4th table frame, filter the field1 to Machine # = 3 & a corresponding sum fld will honor the filter. Now depending what data is shown in the original table, hide the applicable fields above. This powerful methodology should do the job nicely. It places the results of 3 queries on your desktop and continuously updates them as records are added and/or deleted. Your only concern between uses of course, is that one or more of the filters get dropped! (see dropGenFilter) 
|
|
Posted 24 years ago
|
|
| About Ed C. |
|
Approved member.
Member subscribes to this thread with a verified email.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #6276 (Level 1.4)
Reply to 5938
Reply Posted 5/17/2002 2:51:00 PM
|
|
|
|
Location=Colorado Springs, CO
|
|
 |
|
|
|
Philip.Graham
|
I can see what you want is really quite simple if you do not want it to be interactive. I use TCursor intensively and it will do your task although there will be other ways to acheive same result. Assuming you have a form with three undefined fields each renamed in Properties 'fldMachine1', '...2",etc then try this code in the open method of Page2: method open(var eventInfo Event) var tcMachine, tcThisMachine TCursor tbl Table sTblName, sMachineNum, string siMachine SmallInt qMachine Query endVar for siMachine from 1 to 3 ; to Total number of machines (3 in this instance) sMachineNum = string( siMachine ) ; embedded tilde var in query tcMachine.open( ":PRIV:ROLLS.DB" ) ; open TCursor ; Query to find same machine Num qMachine = Query ANSWER: :PRIV:ANSWER.DB
:PRIV:Rolls.db | MachineNumber | RollWeight | | Check ~sMachineNum | Check |
EndQuery
If not qMachine.executeQBE() then errorShow() endIf tcThisMachine.open( ":PRIV:ANSWER.DB" ) ; associate TCursor with answer table ; fldMachine# is a renamed [field] on the form formatted as number ; with 10 digits and two decimal places into which the sum of the 'RollWeight' ; column is placed. (This could also be a plain Text box for display only) switch case sMachineNum = "1" : fldMachine1.value = format( "w10.2",tcThisMachine.cSum( "RollWeight" ) ) case sMachineNum = "2" : fldMachine2.value = format( "w10.2",tcThisMachine.cSum( "RollWeight" ) ) case sMachineNum = "3" : fldMachine3.value = format( "w10.2",tcThisMachine.cSum( "RollWeight" ) ) endswitch ; As many Machine Numbers as needed as in For loop tcThisMachine.close() ; Cleanup for next machine Number by deleting Answer Table sTblName = privDir() + "\\Answer.db" tbl.attach(sTblName) if tbl.isTable() then tbl.delete() else message( "Can't find ", sTblName, "." ) endIf endfor tcMachine.close() endMethod
Good luck -PGG-
|
|
Posted 24 years ago
|
|
| About Philip.Graham |
|
Inactive member.
Member does not subscribe to this thread.
|
Email Not Verified!
Once email is verified, we will review and approve the account.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #5940 (Level 1.5)
Reply to 5938
Reply Posted 4/23/2002 2:04:00 AM
|
|
|
|
Location=-- USA
|
|
Revive Thread!
Add a comment to revive this old thread and make this archived thread more useful.
| Thread #5938 Counter |
| 18215 |
|
Since 4/2/2008
|
|
|