# Spreadsheet Arithmetic Work Orders — Calculate and Log (WorkView)
This procedure turns a spreadsheet of arithmetic work orders into calculated answers. Each row of an Excel workbook supplies two numbers and the name of an operation; the row is placed on a control list of pending jobs, worked one at a time on the Windows Calculator, and the answer typed into a Notepad window that acts as a running log. The release it comes from is a Blue Prism training pack, so several half-finished practice variants of the same flow (CalFull, CalFull1, Modify Queue) and unrelated drills (an Order System sign-in test, loop and parameter exercises) sit alongside the live flow — **WorkView is the only end-to-end process**.
## At a glance
| | |
|---|---|
| **Trigger** | Manual start of the *WorkView* process. The run loads the Excel file itself, so nothing needs to arrive beforehand. |
| **Frequency** | Not recorded in the source |
| **Systems used** | Microsoft Excel; Windows Calculator (`calc.exe`); Notepad; the Blue Prism control list ("work queue") named **Read Excel**. Two other systems appear only in practice processes: the **modify queue** control list and the Training Order System. |
| **Inputs** | `D:\Users\rajmanda\Desktop\Book1.xls` — one row per job with columns **X**, **Y**, **Operation** |
| **Outputs** | Result text typed into the active Notepad window (not saved to a file); each job on the **Read Excel** list marked Completed or flagged as an exception |
| **Typical run** | As written, one job per run — the outline shows no loop back to fetch the next job after one item is completed |
| **Owner** | Not recorded in the source |
## Before you start
- An interactive Windows desktop session (not a locked or headless machine). Calculator and Notepad are launched automatically if they are not already open, so no manual preparation of those is needed.
- Read access to `D:\Users\rajmanda\Desktop\Book1.xls`. If this path does not exist the run fails before any workbook opens.
- The workbook must contain columns literally named **X**, **Y** and **Operation**. The Operation value for every row must be one of: `Add`, `Subtract`, `Multiply`, `Divide`. Anything else stops that job.
- A control list (Blue Prism "work queue" — a shared holding list of pending jobs) named **Read Excel** must already exist in the environment.
- Close or empty any Notepad window you do not want written into. The bot attaches to the first window whose title ends in "Notepad" and types into it; it does not create a clean file.
- No credentials are required for this flow. (The separate Order System practice process needs a staff number and password; no source for those is named anywhere in the release.)
## Procedure
### Stage 1 — Load the Excel work list onto the control list
1. Start a fresh Excel session.
2. Open `D:\Users\rajmanda\Desktop\Book1.xls`.
3. Read a worksheet in one go as a table of rows. **Ambiguous in the source:** no sheet name is passed, so whichever sheet is active/default is read. Confirm the intended sheet before running against new files.
4. Add every row read from the sheet onto the control list **Read Excel** as individual jobs. No priority, tags, deferral date or starting status are set.
### Stage 2 — Make Calculator ready
1. Check whether the bot is already connected to Calculator.
2. **If not connected, then** connect to the window titled `Calculator` (process `calc`).
3. **If that connection fails, then** launch Calculator and wait up to **5 seconds** for its main window to appear. If it still does not appear, the run stops with the system error *"Application Not Found"*.
### Stage 3 — Make Notepad ready
1. Check whether the bot is already connected to Notepad.
2. **If not connected, then** connect to a window whose title ends in `Notepad` (process name matching `notepad*`).
3. **If that connection fails, then** launch Notepad and wait up to **1 second** for the window. If it does not appear in that second, the attach step simply exits — no error is raised here, and the failure only surfaces later when the bot tries to type.
### Stage 4 — Take the next job off the list
1. Request the next unworked job from the **Read Excel** list. No key or tag filter is applied, so jobs come off in list order.
2. Record the job's reference, its row data (X, Y, Operation), its status and how many times it has been attempted.
### Stage 5 — Stop if there is nothing to work
1. **If no job reference came back** (the list is empty or everything is already worked or locked), **then** end the run cleanly with no work done.
2. **Otherwise**, continue to Stage 6.
### Stage 6 — Perform the calculation
1. Bring the Calculator window to the front.
2. Type the first operand, **X**, from the job's row data.
3. Press the key matching the **Operation** value:
| Operation value | Key pressed |
|---|---|
| Add | `+` |
| Subtract | `-` |
| Multiply | `*` |
| Divide | `/` |
**If the Operation value is none of these four, then** the job stops with the business error *"Invalid Operation"*.
4. Type the second operand, **Y**.
5. Press `=`.
6. Read the answer from the Calculator's result display.
7. Press `Cancel` (C) to clear the Calculator ready for the next job.
### Stage 7 — Record the result in Notepad
1. Re-confirm the Notepad connection (repeats the Stage 3 check).
2. Bring the Notepad window to the front.
3. Prepend a separating space to the result text so entries do not run together.
4. Type the text into Notepad.
> **Source inspection needed before relying on this stage.** The typing step does not send the passed-in result directly — it sends the Notepad component's own internal text value `a1`, whose design-time default is the literal text **"Raj"**. Immediately before the typing step, the "Add space" calculation writes into `a1`; most plausibly it writes the passed-in result with a leading space, but that expression is not recorded in the outline, so it cannot be confirmed from what is available here. Before running for real or rebuilding, open the "Add space" calculation and verify it writes the passed-in value; if it does not, Notepad will receive the default "Raj" instead of the calculated answer.
### Stage 8 — Close the job off
1. Mark the job on the **Read Excel** list as **Completed**.
2. End the run.
> The outline shows **no loop back to Stage 4**, so a single run works exactly one job. If the intent is to clear the whole spreadsheet, either re-run once per row or add a loop from Stage 8 back to Stage 4 when rebuilding. Note also that the Excel workbook, the Excel session and Notepad are all left open when the run ends — nothing closes or saves them.
## Exceptions and recovery
| Condition | What the automation does | What a human should do |
|---|---|---|
| Any unhandled failure while working a job (Calculator, Notepad or list step fails) | Flags the job on **Read Excel** as an exception, with the captured error text as the reason, then resumes and ends the run. No retry flag is set in the source. | Review the flagged job, fix the underlying cause (row data, window state), and re-present the job for working. |
| **Read Excel** has no available job | Ends cleanly, no work done. | Confirm Stage 1 actually loaded rows; check the file path and that the sheet was not empty. |
| Calculator cannot be connected to or launched within 5 seconds | Raises system error *"Application Not Found"*. | Check Calculator is installed and the desktop session is interactive; restart the run. |
| Operation value is not Add, Subtract, Multiply or Divide | Raises business error *"Invalid Operation"*. | Correct the Operation cell in the source spreadsheet; re-load and re-run. |
| Excel file path missing or is not a file | Excel helper raises *"File Not Found: File: `<path>` does not exist or is not a file"* before any workbook opens. | Restore the file to `D:\Users\rajmanda\Desktop\Book1.xls` or update the path. |
| Excel session reference stale, or named workbook not open in it | Excel helper raises *"Bad Handle"* or *"Workbook Not Found: Workbook named: `<name>` not found in instance: `<handle>`"*. | Close any orphaned Excel processes left by earlier runs and start again. |
| Notepad window does not appear within 1 second of launch | No error is raised at that point; the later typing step fails instead and is caught by the job-level exception handling above. | Open Notepad manually before starting, or lengthen the wait if rebuilding. |
| *(Order System Test Ring practice process only)* Sign-in window does not appear within 5 seconds | Raises system error *"Login screen is not appeared"*. | Not part of the live flow; no production action. |
## Data handled
| Item | Holds | Source |
|---|---|---|
| **Book1.xls worksheet** | The full table of work orders — one row per job | `D:\Users\rajmanda\Desktop\Book1.xls`, read in one pass |
| **Read Excel** (control list) | Pending, completed and exception-flagged jobs | Populated at Stage 1 from the worksheet |
| **Data** (job row) | The fields of one job: `X`, `Y`, `Operation` | Returned when a job is taken off the **Read Excel** list |
| **X / Y** | The two operands typed into Calculator | Job row |
| **Operation** | Which arithmetic key to press: Add, Subtract, Multiply or Divide | Job row |
| **Output / Result** | The answer read from the Calculator result display | Calculator screen |
| **Item ID** | Reference for the job being worked; used to mark it Completed or flag it as an exception | Returned when the job is taken off the list |
| **a1** | The internal Notepad text value that is actually typed; design-time default `"Raj"` | Written at run time by the "Add space" calculation immediately before typing — its expression is not recorded in the outline (see Stage 7) |
| **Products** *(practice only)* | Table loaded onto the **modify queue** control list by the separate *Modify Queue* process | Not populated by anything in the source |
| **My Stuff Number / Password** *(practice only)* | Training Order System sign-in fields; only the staff number is actually written | No credential source named |
## Not determinable from the source
- Schedule, run window and expected daily volume — no scheduling information exists in the source.
- Who owns the **Read Excel** and **modify queue** control lists, and whether flagged items are ever retried or reported on.
- Which worksheet within `Book1.xls` is read; no sheet name is supplied.
- Exact column names and order expected beyond X, Y and Operation, and whether a header row is present.
- Where the Notepad log ends up — the flow never saves or closes Notepad, and never closes the Excel workbook or session.
- Whether multiple jobs per run were intended: no loop back to the "take next job" step exists, and the looping variants (CalFull, CalFull1) work from an in-memory table (`Coll1`) that nothing in the source ever fills.
- The source of the **Products** table in the *Modify Queue* practice process, and what amendment its unexplained "Update Queue Data" calculation applies.
- Credentials for the Training Order System — data items exist and a Password field is mapped on screen, but only the staff-number field is written and no credential store is named.
- What the Notepad "Add space" calculation writes into `a1` — whether it carries the passed-in result through or leaves the design-time default "Raj"; the expression is not recorded in the outline.
- Which of the ~20 processes is the intended production entry point; WorkView is the only end-to-end flow, the rest are drills.
- Downstream consumer of the results, and any reconciliation or sign-off step.
How this SOP was checked
Generated from the project's source files and audited against them. Audit verdict: minor issues, confidence high.
Correctly identifies WorkView as the only end-to-end flow and reproduces its sequence faithfully: Excel load to the 'Read Excel' list (Create Instance → Open D:\Users\rajmanda\Desktop\Book1.xls → Get Worksheet As Collection → Add To Queue), Calculator attach (title 'Calculator', process 'calc', 5s wait, 'Application Not Found'), Notepad attach (title 'Notepad', process 'notepad', 1s wait, no exception raised), Get Next Item, the [Item ID]<>"" branch, the four-way Add/Subtract/Multiply/Divide choice with 'Invalid Operation' on Otherwise, read result, Cancel, paste to Notepad, Mark Completed, and the Recover→Mark Exception(ExceptionDetail())→Resume handler. Ambiguities it flags (no sheet name, no loop back, nothing closed/saved) are genuine. Practice assets are correctly demoted but several are never enumerated (Notepad excercise: open/write 'Hello World'/close; Collection: earliest-order-date scan; Subtract Process / test / test1 driving the hard-coded 8-op-2 'Training Calculator batch4'; Modify Queue's Set Data / Get Item Data / Mark Exception reason 'Error'). The outline's header 'Systems touched: Excel, CSV' lists CSV, which no step in the outline supports and the SOP does not address.
1 correction from the audit was applied to the procedure above.
Remaining minor notes, not corrected:
- Stage 6 — calculation steps — Omits that the Operation page itself calls the Calculator Attach page, while the analogous Notepad re-attach is called out in Stage 7. (Add a first sub-step: 're-confirm/re-establish the Calculator connection (same check as Stage 2)'.)
- Exceptions table — 'Excel session reference stale, or named workbook not open' — Attributes 'Workbook Not Found' to this flow. The stages actually used (Open Workbook) call only CheckInstanceHandle and CheckFileExists; Workbook Not Found comes from CheckInstanceAndWorkbook, which is not shown on any page this flow invokes (Get Worksheet As Collection is among the omitted pages). (Keep 'Bad Handle' and 'File Not Found'; mark 'Workbook Not Found' as possible but not traceable to the pages this flow uses.)
- Exceptions table — Excel 'File Not Found' row — Implies the run simply fails. The Excel load runs on the WorkView main page, which is covered by the Recover/Mark Exception/Resume handler; that handler would attempt Mark Exception with an empty Item ID at that point. (Note that a failure during Stage 1 is still caught by the page-level handler, which tries to flag an item before any item reference exists.)
- At a glance — Trigger; Systems used ('calc.exe'); Stage 6 step 7 ('Cancel (C)'); Stage 7 step 3 ('Prepend') — Small details not present in the source: the trigger is not recorded anywhere (no scheduling or startup parameters on WorkView); the source gives ProcessName 'calc', not 'calc.exe'; the cancel element is named 'press cancel' with no key label 'C'; the 'Add space' calculation's direction (prepend vs append) is not shown. (Mark the trigger as not recorded; use 'process name calc'; drop '(C)'; say a space is combined with the result, direction unspecified.)