Greetings, I have a question that I am not sure of how to ask. This prevents me from accurately searching for a solution, therefore I must rely on good ole fashion verbiage...or in this case Typiage.
I have a database with 10 questions in it. Each question may contain 1 through 10 in the field.
I'm trying to write a program that will basically count for question 1 = 1, 2, 3, 4, and so on. then continue to count for question 2 = 1, 2, 3, 4, and so on. All the way to question 10. My code works perfectly fine for counting only one question's field, ie; count only for question 1 = 1, 2, 3, 4...
Also, the name of my question fields are ques1, ques2, all to ques10 subsequentially.
Here is my code:
do while inc < 11
go top
store "ques"+allt(str(inc)) to mques
* the single line above is where I'm trying to
* assign 'ques1' to mques, all the way to 'ques10'
do while not eof()
store mques to mqt
* the single line above is where I would
* normally type 'store ques1 to mqt'
* which would store whatever is in the ques1
* field to mqt. ie;if ques1 = 2, mqt now = 2
store 0 to mput
do while not eof() and mques = mqt
* the latter half of the single line above
* is where I would type 'ques1 = mqt'
* which if it worked the way I needed it to
* would mean if ques1 has '2' in the field,
* continue.
mput = mput + 1
? mques, mput
skip
enddo
select 2
appe blank
replace re1_10 with mques+mqt, actual with mput
* dont mind the indentation of the single
* line above, this is where I want re1_10
* to say 'ques1' + '1' thru '10', to
* 'ques 10' + '1' thru '10'
select 1
enddo
inc = inc+1
enddo
//end code
My problem is I'm trying to cut corners instead of writing 10 duplicate lines of code for 10 questions to do what could be done with 1 set of code.
What keeps happening is the line 'store ques1 to mqt' would normally store the value of that particular record to mqt so if ques1 was 2, mqt would then be 2. but because I use 'store "ques"+allt(str(inc)) to mques' mques goes through the cycle ten times, each time increasing inc: ques1, ques2, ques3 and so on, but the line 'store mques to mqt' doesn't store the value of ques1, or ques2 and up, instead it makes mqt actually equal the word 'ques1' instead of the value.
This is my issue and this is what I am hoping you can help me with.
ps I tried storing 0 to mqt before storing mques to mqt to make it register mqt as a numeric field, but still it does not work. I'm going to continue trying to figure it out but help would be greatly appreciated.
Thanks.
I have a database with 10 questions in it. Each question may contain 1 through 10 in the field.
I'm trying to write a program that will basically count for question 1 = 1, 2, 3, 4, and so on. then continue to count for question 2 = 1, 2, 3, 4, and so on. All the way to question 10. My code works perfectly fine for counting only one question's field, ie; count only for question 1 = 1, 2, 3, 4...
Also, the name of my question fields are ques1, ques2, all to ques10 subsequentially.
Here is my code:
do while inc < 11
go top
store "ques"+allt(str(inc)) to mques
* the single line above is where I'm trying to
* assign 'ques1' to mques, all the way to 'ques10'
do while not eof()
store mques to mqt
* the single line above is where I would
* normally type 'store ques1 to mqt'
* which would store whatever is in the ques1
* field to mqt. ie;if ques1 = 2, mqt now = 2
store 0 to mput
do while not eof() and mques = mqt
* the latter half of the single line above
* is where I would type 'ques1 = mqt'
* which if it worked the way I needed it to
* would mean if ques1 has '2' in the field,
* continue.
mput = mput + 1
? mques, mput
skip
enddo
select 2
appe blank
replace re1_10 with mques+mqt, actual with mput
* dont mind the indentation of the single
* line above, this is where I want re1_10
* to say 'ques1' + '1' thru '10', to
* 'ques 10' + '1' thru '10'
select 1
enddo
inc = inc+1
enddo
//end code
My problem is I'm trying to cut corners instead of writing 10 duplicate lines of code for 10 questions to do what could be done with 1 set of code.
What keeps happening is the line 'store ques1 to mqt' would normally store the value of that particular record to mqt so if ques1 was 2, mqt would then be 2. but because I use 'store "ques"+allt(str(inc)) to mques' mques goes through the cycle ten times, each time increasing inc: ques1, ques2, ques3 and so on, but the line 'store mques to mqt' doesn't store the value of ques1, or ques2 and up, instead it makes mqt actually equal the word 'ques1' instead of the value.
This is my issue and this is what I am hoping you can help me with.
ps I tried storing 0 to mqt before storing mques to mqt to make it register mqt as a numeric field, but still it does not work. I'm going to continue trying to figure it out but help would be greatly appreciated.
Thanks.