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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make workload list for each employee

Status
Not open for further replies.

harrymossman

Technical User
Sep 5, 2002
255
US
I have been using Paradox for quite a while but I've never worked much with loops.

I've been asked to take a workload table (in Paradox) and create individual workload reports in MSWord. I.e., a separate document for each employee. Making them in Excel would be an option too.

It seems like I need to loop through the employees with open projects but I have tried various code that doesn't work at all.

Code:
method pushButton(var eventInfo Event)
var
   q	query
   tc	tcursor
endVar

q=Query
ANSWER: :priv:Workload.DB
:LOG:log.db | Received | Year  | LogNum | Branch |
            | Check    | Check | Check  | Check  |
:LOG:log.db | Project  | Assigned | Date Completed |
            | heck     | Check    | Blank          |
EndQuery

if not executeQBE(q) then
errorShow()
msginfo("Error","Unable to run query")
endIf

tc.open("workload.db")
tc.edit()
scan tc:
{Here we would like to make an MS Word document for each employee (each of the "assigned") with the log info. Ideally each document would have some additonal common fields.}
endScan
tc.endEdit()
tc.close()

endMethod
 
What is the question?

You can write each record out as a *text* file, and open that in Word. This would be pretty simple.

If you want the ending files to be actual Word files, then I for one can't help.

What is the actual end goal?

A couple of issues with your code:

1. You write the table to :pRIV:, but open the tcursor on :WORK: by default
2. Do you really want 'heck' projects? :)



Tony McGuire
"It's not about having enough time. It's about priorities.
 
Oh. It would also be helpful if you tell us what version of Paradox.

For those who may be familiar with exporting to a Word document, this may make a difference.

Tony McGuire
"It's not about having enough time. It's about priorities.
 
The below should allow you to create an actual Word document, IF you have Word installed on the workstation doing the Paradox stuff.

The contents of the document would be set with the
oleActiveDocument^Content =
statement. Likely you would want to prepare a string and assign it.

Code:
var
 oleWord           OleAuto
 oleDocument       OleAuto
 oleActiveDocument OleAuto
endVar

 oleWord.open("Word.Application")
 oleWord^Visible = True
 oleWord^WindowState = 0
 oleDocument = oleWord^Documents
 oleDocument^Add()
 oleActiveDocument = oleWord^ActiveDocument


oleActiveDocument^Content =
 "This is a line of inserted text." + CHR(10) + CHR(13)

 oleActiveDocument.SaveAs("c:\\data\\mydoc.doc")
 oleWord^Quit()
 oleword.close()

Tony McGuire
"It's not about having enough time. It's about priorities.
 
>>Do you really want 'heck' projects? :)
We actually call them something stronger than that :)

Thanks for all your suggestions.

What really has me stumped is how to use scan write an individual report for each employee. I.e., we want Paradox to put all of Employee, One into a report. Then Employee, Two. Etc. This would be based on the field 'Assigned'.

Of course, we need to save each report with a file name that includes the employee's name. We currently have a form that makes workload Paradox reports one at a time. It uses the following code, where qArray[2] is the first name and qArray[1] is the last.
Code:
qSelected = Assigned.value
qSelected.breakApart(qArray, " ,")
. . . .
iRptName = qArray[2] + "_" + qArray[1] + "_workload.rsl"

Harry Mossman
 
Saving the report does NOTHING.

The report has to reference the individual's DATA, not just be named appropriately.

Every report would have ALL data that is in the table the report is associated with.

Tony McGuire
"It's not about having enough time. It's about priorities.
 
Yes, I understand that. Probably I confused the issue by mentioning the save aspect. I don't understand the basic issue of how to use scan to select one employee at a time. Or maybe scan isn't the right thing to use.
 
Scan stops at each record in a tcursor, in turn.

Within the scan, any code you place acts on each record individually, before the tcursor continues the scan and moves to the next record.

Tony McGuire
"It's not about having enough time. It's about priorities.
 
In the latest query you posted, in the 'Assigned to' field you have

~assigned Check


That needs to be

Check ~assigned

I believe.

And unless you are doing more than you are showing, the tcursor doesn't need to be in edit. In fact, you are more likely to cause yourself issues with edit().

Tony McGuire
"It's not about having enough time. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top