Updating a HUD through the API

Discussions related to order tracking development with the ProForm module.

Moderator: Phil Barton

Post Reply
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Updating a HUD through the API

Post by chris.brady »

I am trying to utilize the SoftPro API to update the HUD, but I am having trouble getting certain lines, and within those lines, certain fields updated with new data.
My setup is like this: I have an editable grid within a windows form that reads the existing HUD through the API, and allows users to make changes to the description, bill code, GFE, and multiple other fields. When the user clicks a button to update, the code reads through the existing SoftPro HUD, finds the line number that corresponds to the line number on the grid, and then tries to repopulate each field within the line with whatever data the user entered.

However, I can’t find any consistency to which fields are updatable and which are not via the API. I’ve checked the SDK documentation and cannot find any clues as to what I should be doing. I've attached an image of a snippet of the code I'm using.
code.jpg
code.jpg (39.59 KiB) Viewed 3173 times


I have tried updating an existing order in the system, as well as create a brand new order from scratch and updating that HUD. With the existing order, I attached Select to the Visual Studio debugger to see what was happening. When I step through lines 140-146 of the snippet that set the Description and Buyer Amount on line 207, the changes don’t get set. I then tried line 506, and in that case, it let me update the description successfully.
I realize there is a lot of validation going on behind the scenes, and for the most part, the code throws exceptions if I try to update something that I wouldn’t be able to through the GUI. However, in the cases above, I can update through the GUI, but not through the API.

For reference, we’re accessing the open order in Select through the following method.

/// <summary>
/// If an order is open and active in select, return it. Otherwise return null.
/// </summary>
private IOrder GetActiveOrder()
{
IWindowManager windowManager = GetService<IWindowManager>();
IWindowFrame activeDocument = windowManager.ActiveDocument;
IRunningDocumentsManager runningDocumentsManager;
IRunningDocumentInformation runningDocumentInformation;
EditorPane p;

if (!Common.HasValue(activeDocument)) return null;

runningDocumentsManager = GetService<IRunningDocumentsManager>();
runningDocumentInformation =runningDocumentsManager.FindDocument(activeDocument.DocumentHandle);

if (!Common.HasValue(runningDocumentInformation)) return null;

p = runningDocumentInformation.Data as EditorPane;

if (!Common.HasValue(p)) return null;

// Return the order.
return p.GetProperty("Order") as IOrder;
}
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: Updating a HUD through the API

Post by Melissa McBerkowitz »

You've hit a tricky area of the API - the way Select handles HUD lines is not obvious. It sounds like this would be a great place for us to add documentation or sample code in the future.

Each HUD line in Select has a collection of IHudLineAdditionalCharge objects. Each HUD line has at least one charge. Through the UI, you can view/add/edit/delete charges by clicking the "+=" button on the HUD line.

If there's only one charge on a HUD line:
When you edit a HUD line through the UI, you are really editing the first charge. The business logic then rolls that data up to the HUD line itself. Onscreen though, you're always bound to the first charge, never to the HUD line directly. You therefore want to update your code to modify the first charge instead of the HUD line, and then you should see your data reflected in the UI.

If there are multiple charges on a HUD line:
You would still edit individual charges to itemize them (like on 1101 or 1102). The business logic will sum your data to the HUD line for you. The only time you'd edit the HUD line directly is if you have multiple charges and need to change a field like description or Re:. Note that many fields on the HUD line are read-only when there are multiple charges.

Special note on front of the HUD lines:
For credit/debit lines, make sure you edit the charge on the buyer's side (100 or 200 sections) and set the IsCreditDebit field there, which will populate the data forward to the seller's side. This won't work properly if you start from the seller's side (400 or 500 sections).

Hope that helps!
Melissa McBerkowitz
VP of Product Strategy, SoftPro
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Updating a HUD through the API

Post by chris.brady »

Excellent, that definitely helps! Using the IHudLineAdditionalCharge collection now lets me perform the updates I need.

I haven't gotten as far as dealing with multiple charges on a line yet, but the information you gave on that topic will definitely be helpful when I get to that point.

Thanks for your help!
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Updating a HUD through the API

Post by chris.brady »

I have a followup item to add to this question. It has to do with deleting existing HUD lines through the API.

Let's say we have an order, and for whatever reason the user has completely messed up the HUD. What if we wanted to clear out/ reset the HUD and start from scratch? Even if we had already applied templates to a HUD? This could involve deleting lines one by one, similar to what the +- buttons do within Select, or it could mean hitting a button and clearing out the HUD in one fell swoop.

I searched the doucmentation for the IHudLineAdditionalCharge and other interfaces, but I don't see anything for a delete function. We had heard about a setting to use 2009 RESPA regulations that would do something like this, and I found a boolean in the IHudOption interface called Use2009RESPARegulations. I played with it a bit, and it does seem to do some massive resetting of the HUD, but it seems a bit like a hack, and I'd rather use something official.

Thanks for any input you can provide.
john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

Re: Updating a HUD through the API

Post by john.morton »

Unfortunately, there is currently no clean/direct way to just force a reset of the HUD.
Post Reply