OrderCloud filtering by empty extended properties - ordercloud

I have extended property IsDeleted in Buyers entity. And I want to filter buyers who don't have this property or have it with false value. How can I do that?

UPDATE: this is supported as of 1.0.72
Now, xp filters don’t just look for the specified xp and filter down from there. Instead, a filter of xp.Color=!Blue will return all items with xp.Color where the color isn’t blue, but also any items without xp.Color at all.
There is no current way to filter on xp properties that do not exist (though it is on the roadmap). The recommended solution is to make sure all of your Buyers have the xp property of IsDeleted, and then filter on the values where it is false.
GET /buyers?xp.IsDeleted=false

Related

Search products by price range, using default block search

Did someone know what have I to do, to make a possible search products by price range? I know, that Block Layered can filter by it, but it only works in specified category.
You would have to:
1) Add extra input fields next to search box: from and to. The fields must be inside the form element. You can do this by overriding blocksearch.tpl in your theme.
2) Next, you should make override for classes/Search.php, method find(). You should modify SQL queries at line 252 (PS 1.6.0.11). Use Tools::getValue('from') to add extra SQL WHERE statement.

What is the correct query parameter for "match-all" in a REST filter when there is a default?

If a REST API endpoint gets all, then filters are easy. Lack of a filter means "get all results".
GET /persons - gets all persons
GET /persons?name=john - gets all persons with name of "john"
But if there is a default, then I need some way to explicitly not set the default filter. Continuing the above example, if each person has a state, "approved" or "pending", and if my system is set such that if I do not explicitly specify a state, it will return all "approved":
GET /persons - gets all approved persons, because defaults to state=approved
GET /persons?state=approved - same thing, gets all approved persons
GET /persons?state=pending - gets all pending persons
How do I get all persons? What if there are 10 possible states? Or 100?
I can think of a few ways:
GET /persons?state=any - but then I can never use the actual state any
GET /persons?state=* - would work, but feels strange? Or is it?
GET /persons?state= - some URL parsing libraries would complain about a blank query parameter, and does this not imply "state is empty" as opposed to "state is anything"?
How do I say in my GET, "override the default for the state to be anything"?
Maybe this could work for you:
GET /persons?state - gets all persons that have a state name, no matter which value
GET /persons?state= - gets all persons that have an empty value for the state name
You probably don’t need to differentiate between these two situations, so you could use either one for getting all persons with the state name (I just think that the variant without = is more beautiful).
FWIW, the application/x-www-form-urlencoded format (i.e., typically used in HTML forms) doesn’t differ between an empty and no value.
As far as the URI standard is concerned, this name-value pair syntax in the query component is only a convention anyway, so you can use whichever syntax/semantics you wish.
I don't think there is one answer to this question. As long as you document that the default state is approved well I don't think it matter to the clients if you pass any, * etc. All of your proposals are fine except the last one. I don't think that is a good one.
If I was designing the API I would use all and keep this as a standard. I would also recommend to use paging for all endpoints that returns list of elements. I use offset and limit as paging query parameters. In my API I return 20 elements as default if the client haven't specified another paging criteria.

Wix Bundle, MsiPackage InstallSize attribute limited to 2,147,483,647 (need 15gb)

One package in our installer bundle downloads data from our server and then uncompresses it. The size of this data is 15gb.
I want to put this value into the Add/Remove programs size column.
The InstallSize attribute would appear to do what I want however, when I set it "15050494389" I get the following error:
The MsiPackage/#InstallSize attribute's value, '15050494389', is not a legal integer value. Legal integer values are from -2,147,483,648 to 2,147,483,647.
Ignoring why I would want a negative value, is there a way of setting the value correctly? Is there some setting I need to tell burn that I want values bigger then 32bit?
That's not supported today in WiX v3.8. You can file a feature request.
I thought this property would be set automatically? Either way, it looks like you need kilobytes, not bytes for this field. Try 15728640.
Are you referring to ARPSIZE or something else btw?
Add or Remove Programs Entries
Configuring Add/Remove Programs with Windows Installer

How can I let user input a value not listed in a pull-down list?

This is really a "best practices" question: Assume I have a dynamically generated pull-down list populated with suggested values (e.g. [Vanilla, Strawberry, Chocolate]). How do I give the user the option of selecting one of the suggested values OR inputting a new value (e.g. "Rocky Road")?
One approach would be to populate the list with a None of the Above entry ([Vanilla, Strawberry, Chocolate, None of the Above]) and write my controller so that if None of the Above is selected, it will then render a form with a text field instead of the pull-down. But that feels horribly clunky.
Is there some elegant GUI technique for this sort of thing, perhaps using JQuery?
I suggest you to use simple text input with jquery autocomplate plugin don't use pull-down list. Autocomplate can work with datas you populated. If user inputs a new value, in controller use find_or_create_by dynamic activerecord method.

How to handle ViewModel and Database in C#/WPF/MVVM App

I have a task management program with a "Urgency" field. Valid values are Int16 currently mapped to 1 (High), 2 (Medium), 3 (Low), 4 (None) and 99 (Closed). The urgency field is used to rank tasks as well as alter the look of the items in the list and detail view.
When a user is editing or adding a new task they select or view the urgency in a ComboBox. A Converter passes Strings to replace the Ints. The urgency collection is so simple I did not make it a table in the database, instead it is a, ObservableCollection(Int16) that is populated by a method.
Since the same screen may be used to view a closed task the "Closed" urgency must be in the ItemsSource but I do not want the user to be able to select it. In order to prevent the user from being able to select that item in the ComboBox but still be able to see it if the item in the database has that value should I...
Manually disable the item in the ComboBox in code or Xaml (I doubt it)
Change the Urgency collection from an Int16 to an Object with a Selectable Property that the isEnabled property of the ComboBoxItem Binds to.
Do as in 2 but also separate the urgency information into its own table in the database with a foreign key in the Tasks table
None of the above (I suspect this is the correct answer)
I ask this because this is a learning project (My first real WPF and first ever MVVM project). I know there is rarely one Right way to do something but I want to make sure I am learning in a reasonable manner since it if far harder to Unlearn bad habits
Thanks
Mike
I would favor option 2. Sounds very MVVM-stylish to me.
Option 3 would be favorable, when there are other applications or when you have reports accessing the "Urgency" field. Reason: Otherwise you will need to duplicate the knowledge of mapping between Int16 and their meaning. Move the knowledge to the database to keep it in one place.
Maybe consider Enums to make the code more expressive:
enum Urgency { High=1, Medium=2, Low=3, Closed=99 };
This way you will have something nice looking for evaluating the IsEnabled property like this:
if (urgency == Urgency.Closed) return false;
When you need to store the numeric value of the enum, you will need to make a cast to Int16 beforehand.
I think that I'd first fix this in the view. Have a TextBlock that displays "Closed", and a ComboBox that displays the other values, and then use a data trigger to set IsVisible on both depending on whether or not Urgency is 99.
I'd do this not because it's the best technical solution (it's probably not) but because it's (possibly) the best UI solution. If the user can't ever modify a closed item, it's a little misleading to display "Closed" even in a disabled ComboBox, since the ComboBox means, visually, "Here's something you can change." That it's disabled just prompts the user to wonder what he has to do to enable it. Using a TextBlock is an unambiguous way of saying "this is just how it is."