Solr fields sorting by 2 fields treated as one - sorting

I am bit struggling with one topic for custom fields.
By default all documents have field price_double to keep default price.
Next I got requirement that there should also be customer prices defined per document, so I have added fields like price_[customerId]_double next to default one.
These fields are optional and number of these fields per doc varies. When I get documents, if custom one exists I fetch it as default and use on storefront. that functionality is handled in app code.
Then I got requirement about sorting and treat price as ranged facet. But to have same behavior like custom price is default. Meaning, when I sort default and custom prices these 2 fields should be treated as one so result may look:
Custom - $1
Default - $2
Default - $3
Custom - $4
Same with range faceting. Do you have any hints how to tackle that?
Thank you a million.

And the winner is method which I posted in comment:
if(exists(price_[customerId]_double),price_[customerId]_double,price_double)
Keep in mind that if works with boolean/integer/double values. Does not work with string and texts.

Related

Grafana Templating

I am wondering if there is a way to limit the number of rows generated from grafana templating.
I can have a drop down variable "$x"on my grafana page and I can select the row editor and say repeat row for every value under $x.
Based on different criteria, I can have x anywhere between 1 and like 160 rows. I need to only be looking at about 10 at a time. I am wondering if I can control the number of rows shown/change the rows shown somewhere in grafana.
I can manually select items from the $x drop down to show only a few items of course, but its a matter of selecting only say.. 10 items right when the page loads.
Please let me know if I am not describing the problem correctly or if I need to clarify more.
Thanks,
Karan
As far as I know there is no direct option for this but there are some ways you may be able to achieve what you want.
You could select your ~10 default entries and then save the dashboard this will save the selected ones in the dashboards JSON. (or modify the JSON of the dashboard directly)
You could use the regex field in the template settings to filter some of your values and split them in groups this way. (one variable per regex group)
You could change your data in elasticsearch in order to use multiple fields where you can split on.
see PR #5616 as #Daniel Lee mentioned
In general I think you get a faster response to this in grafana directly at github.

Is it possible to multiply by -1 in a CRM Dynamics 2016 Workflow?

I'm trying to create a workflow that would make the target field value a negative number. I want to create related records as credits and debits and then be able to sum them up to get a net value.
I've tried to update the field to -1 and then multiply it accordingly, but I get an error stating that the value needs to be between 0 and 1,000,000,000,000. I've also just tried to multiply the value by a -1, but that doesn't work either. It just runs the workflow, but doesn't change the value.
Building on the comment from #MarioZG it looks like your CRM field doesn't allow negative numbers.
When you setup a number field (Decimal; Currency; Floating or Whole Number) you can specify the range of acceptable values. Here's a quick screenshot of the Whole Number's properties:
I actually figured this one out. I created two different workflows to create records in one entity with different "Types". Then, on the account I had a rollup field to sum one type and then a rollup type to sum the other type. Then I used a calculated field to subtract one from the other.
Use data type of the field as decimal number(looking at your use), in this case you will have flexibility of storing all sort of numbers.

Search operator trigger field validation in Filemaker

I'm having a bit of trouble with searching with search operators in validated fields in Filemaker Pro 13.
I have a field which has validation "numeric only", since it stores a numerical value. However, when I enter find mode I cannot use one of the pre-defined search operators such as * for "zero or more characters" or even # for "any one digit".
When I enter one of these operators in the field and try to search, Filemaker gives me a validation error and says that the field contents has to be numerical.
Is there a way to get around this problem?
That's irritating.
I just:
Created a test file
Created a Number field
Added the Strict data type option and set it to Numeric Only
Made sure validation was set to Only during data entry which should not engage in find mode
Created a couple of records and inserted values into the field
Performed my find for * and got the same error message
This feels like a bug in FileMaker to me. I don't remember running into it in previous versions, but it could be there too. I would not consider Find Mode a data entry mode so you'd think the validation rules wouldn't apply.
All that said, you could use a calc field as a work around.
Crate a calculation field in the same table and name it yourfieldnameSEARCH, e.g. idSEARCH. The calculation for the field can just be the field you actually want to search on:
e.g. `mytable::idSEARCH = mytable::id`
You can set the index to All for the calculation field so that the searching is faster. Since the calculation field is in the same table as it's reference, modifications to the original field will be reflected in the calculation automatically.
Now you can search in the SEARCH specific field without the validation being applied.
As far as the "bug" itself, you can submit it to FileMaker and maybe they'll take care of it or at least explain why it's happening.
This is true going back at least as far as FileMaker 11.
The problem is that * and # are placeholders for characters in strings. The numerical operators, <, >, <=, >=, ... work just fine even with a strict data type of numeric only. = will also work to find blank values.
For a true numeric field, however, these should cover most of your searches:
To find blank values, search for = in the numeric field.
To find all non-blank values, search for = in the numeric field and click omit on the record.
To find values between x and y use x...y in the search field.
Replicating the # operator is trickier. You could possibly replicate it with a new field that calculates the mod of a number or converts the numeric field to a string and get's the nth character.
Apparently, this form of validation is intended for Text fields.
Note that most find operators do work, despite the validation: =, ==, !, ?, ... and all the comparison operators < > ≤ ≥.
If there is a bug here, it concerns the # operator, which Filemaker expressly designates to find "one or more digits in a number field".
Two possible workarounds:
Change the field's type to Text (note that this may affect the way the field is sorted);
Replace the strict numeric type validation with validation by calculation.

Orbeon form builder - limit repeating element based on field value

I am using Orbeon Form Builder and have a form with a repeat section. The no. of repeats has been set to 3 however I want to vary this depending on the value set in another field. Do you know if this is possible?
The field and repeating element are in different sections on the form.
Thanks
Paul
I created a working example. The idea:
place an event handler reacting to a change of value of the count field
depending on whether the value is larger or smaller than the current number of iterations, remove or insert new iterations
this relies on the xxf:bind() function, and on knowledge of the grid repeat template
This said, as is I don't think it's a good user interface, as it can delete data upon tabbing out of the count field.

iReport java.lang.Float hide decimals if zero

From IBM iSeries DB2 I recieve a ordered quantity DEC 11,4.
In iReport I use java.lang.Float to print the value. Also I have a pattern #,##0.0000;-#,##0.0000 (4 Decmimal places, 1000 separator).
When something is ordered in Metric Tons, this is no problem, but when something is ordered in pieces, it also prints "2,0000". This is confusing, how do I hide the ",0000"?
You can use two fields (Text Field, for example) for showing value. You can set visibility for fields (with help of "Print when expression" property) - show one field with #,##0.0000 pattern (for metric tons) and hide another with #,##0 pattern (for pieces).
Expression can check parameter or field, for example:
$F{valueUnit}.equalsIgnoreCase("metricTon")

Resources