Order Number Prefix Questions
Moderator: Phil Barton
-
- Posts: 82
- Joined: Tue Jan 21, 2014 11:35 am
- Location: Austin, TX
Order Number Prefix Questions
Hi, we have a scenario in which a Title order needs to be transferred between office branches, and possibly Select profiles. In doing so, the user wants to be able to reset the order number with a different prefix which corresponds to the new profile/area.
1) Is it possible to retrieve a list of the Order Number Prefixes for a given Profile using the API? If so, can you provide a snippet?
2) Is it necessary to also switch the order's Profile if resetting the order number with a new prefix from a different profile?
Thanks.
1) Is it possible to retrieve a list of the Order Number Prefixes for a given Profile using the API? If so, can you provide a snippet?
2) Is it necessary to also switch the order's Profile if resetting the order number with a new prefix from a different profile?
Thanks.
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Order Number Prefix Questions
1) Is it possible to retrieve a list of the Order Number Prefixes for a given Profile using the API? If so, can you provide a snippet?
You can enumerate the list of Order Numbering groups to find much information.
2) Is it necessary to also switch the order's Profile if resetting the order number with a new prefix from a different profile?
I don't quite understand. Changing the profile for an order will not change the order name.
You can enumerate the list of Order Numbering groups to find much information.
Code: Select all
var numMgr = ss.GetService<IOrderNumberingManager>();
var group = numMgr.OrderNumberingGroups.Where(t => t.Name == "ANumGrpName").FirstOrDefault();
var prefixes = group.AvailablePrefixes.ToList();
var suffixes = group.AvailableSuffixes.ToList();
var profiles = group.Profiles.ToList();
I don't quite understand. Changing the profile for an order will not change the order name.
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 82
- Joined: Tue Jan 21, 2014 11:35 am
- Location: Austin, TX
Re: Order Number Prefix Questions
OK, that was what I needed. BTW, disregard question 2; it did indeed turn out to be irrelevant.
But now, I have another problem. On the order, the properties "Prefix", "Number", and "BaseNumber" are all read-only for an order that has been created in a previous session. Is there any way of getting around this? Ideally, I'd only need to update the "Number" field.
But now, I have another problem. On the order, the properties "Prefix", "Number", and "BaseNumber" are all read-only for an order that has been created in a previous session. Is there any way of getting around this? Ideally, I'd only need to update the "Number" field.
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Order Number Prefix Questions
Once the order is saved, Select does not maintain it as separate parts (prefix, number, suffix) - just as a string with a maximum of 30 characters. You can rename an order if you wish (assuming it does not conflict with another order) but you have to figure out the prefix/suffix parts on your own.
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 82
- Joined: Tue Jan 21, 2014 11:35 am
- Location: Austin, TX
Re: Order Number Prefix Questions
I'm a bit confused here - when you say "rename an order," what field are you referring to specifically? I've tried setting the "Number" field, but it's showing as read-only, and any attempts to set it are failing, as expected. Is there another field I should be setting instead?
-
- Posts: 82
- Joined: Tue Jan 21, 2014 11:35 am
- Location: Austin, TX
Re: Order Number Prefix Questions
OK, I see the "Rename Order" function in the Select client itself, and that's basically the same thing that I'm trying to do programmatically. I'm pulling the prefixes per profile, as this tool seems to be doing, and attempting to reset the "Number" property on the order itself. Is there another way to mimic the "Rename Order" functionality this way?
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Order Number Prefix Questions
The process is to open the order, rename it, then save the new order.
Code: Select all
// Get the orginal order.
IOrderStore os = ss.GetService<IOrderStore>();
IOrderInfo orderInfo = os.Orders.Where(t => t.Number == "OldNumber").First();
using (IOrder order = os.OpenOrder(orderInfo, OrderEditMode.ReadWrite))
{
// Create a new name for the order.
var spec = new OrderCreationSpec() { BaseNumber = "NewNumber" };
// Set the new name then save it.
order.RenameOrder(spec);
os.ApplyChanges(order);
}
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 82
- Joined: Tue Jan 21, 2014 11:35 am
- Location: Austin, TX
Re: Order Number Prefix Questions
Hey Bob, I found this old thread from a while ago, and now need a good reliable way to get from a specific Profile to the available order prefixes for that Profile via querying the database directly. I've found what seems to be kind of a hacky way to do it, by joining SelectDb.core.NumberingGroup to SelectDb.pf.OrderNumberingGroup, which pairs up the Numbering Group name to the Order Numbering Group's AvailablePrefixes column. I can then pull the Profile with the included LocationState ProfileItem data, and build a string {ProfileItem.Value}-{Profile.Name} to query against that joined Numbering data.
I'd much prefer to do more solid joins via the GUIDs associated with these, for obvious reasons. There doesn't seem to be a reliable dependency path to do this, though. BTW, this is within a web app, and so far, I've tried to avoid pulling in the Select DLLs and using the API and all that extra overhead, hence the need for direct database pulls.
Any insights on this? Thanks.
I'd much prefer to do more solid joins via the GUIDs associated with these, for obvious reasons. There doesn't seem to be a reliable dependency path to do this, though. BTW, this is within a web app, and so far, I've tried to avoid pulling in the Select DLLs and using the API and all that extra overhead, hence the need for direct database pulls.
Any insights on this? Thanks.
-
- Posts: 82
- Joined: Tue Jan 21, 2014 11:35 am
- Location: Austin, TX
Re: Order Number Prefix Questions
Update to the last: I just found pf.OrderNumberingGroupView, which already does the join, so would query against this instead of joining the tables manually.