I am creating a report (in Kentico 10) which has 'cascading' parameters. In order to describe my problem, it is sufficient to mention the following report parameters:
Region (North America, Asia Pacific, etc.) - a dropdown driven by a SQL query
Country (US, CA, MX, DE, FR, etc.) - a dropdown driven by a SQL query, limited by the value of the Region field
When viewing the report, I would like for the value chosen in the Region field to affect the contents of the Country field. The SQL code is not a problem, but actually getting the value of the Country field is.
I have configured the Region field with 'Has depending fields' checked.
I have configured the Country field with 'Depends on another field' checked. In the WHERE clause of its SQL query, I reference '{%Region.Value%}'. (per this article) This does not work. Upon further investigation, I found that the result of {%Region.Value%} is "RegionName", which is the field name specified in the Region field's 'Value column' setting.
How do I access the selected value in the Region dropdown, rather than the name of the field whose value is displayed in that dropdown?
A subsequent question would be: After choosing a Region, the page posts back and my Region choice is lost. How do I make it stick?
(Also, it is not acceptable to replace the SQL-driven dropdown with a static list of regions. This needs to be SQL driven, as there are other dependent fields whose possible values are not static.)
Only the value part is passed to your depending field, so if your region SQL query looks like this:
SELECT RegionID, RegionName from Custom_Region
The RegionID is the value of the {%Region.Value%} macro.
If you need to pass the region Name the query would look like this:
SELECT RegionName, RegionName from Custom_Region
Related
I am creating RDLC Reports (this one is a subreport actually), that hides a specific Text-Box depending on data available/missing.
Specifically, I want to hide a Text Box, using an "Expression", when all values of a specific DataSet are null. Currently I do only check the first value like so:
=(IsNothing(First(Fields!EventDescription.Value, "MyDataSet")))
This works, regarding only the first item in the DataSet, or when it's empty. How can I check for "All". Is there an "All" operator?
I now have
=((Sum(IIF(IsNothing(Fields!EventDescription.Value),0,1), "MyDataSet") ) = 0)
which looks a little complicated, but works. It
checks whether the given Field is NULL
if not so, provides the integer value 1
sums all those values up
hides the text box, when the sum is zero (all fields have been null)
Essentially this converts an aggregate comparison into a sum.
My query is pension paid united nation when I do the full text search its giving top results which contains national word instead of nation word, but I want the result should contains all the words in the query, but don't want national instead of that wants nation word should present in the documents.
How to achieve this with SOLR?
I guess you have a stemmer filter (e.g. PorterStemFilterFactory or SnowballPorterFilterFactory) configured in the field type of the field you are querying.
Remove that or user another field. If you need the stemmed field for something else, you can add a new field and field type without stemmer and copy the content there using
<copyField source="..." dest="..."/>
I want to load a list with thumbnail pictures from the internet. In order to have a good user experiance, I want to load and display the text of the list first, and want to load the pictures from the list in a background thread. When a picture is downloaded I want to show it in (refresh) the correspondig row of the list.
Actually, I don't know where to start. Can I use a TClientDataset component to load the text first and load the pictures in a background thread and insert it with .Locate() .Edit .Post to the dataset?
You can use a TClientDataSet for requesting the data directly, except the picture. Thus, the fetching of the main data should be fast enough.
You should load the picture as a calculated field then. Documentation says (with my own emphasis):
A calculated field displays values calculated at runtime by a
dataset's OnCalcFields event handler. For example, you might create a
string field that displays concatenated values from other fields.
To create a calculated field in the New Field dialog box
Enter a name for the calculated field in the Name edit box. Do not enter the name of an existing field.
Choose a data type for the field from the Type combo box.
Enter the size of the field in the Size edit box, if appropriate. Size is only relevant for fields of type TStringField, TBytesField, and TVarBytesField.
Select Calculated or InternalCalc in the Field type radio group. InternalCalc is only available if you are working with a client dataset. The significant difference between these types of calculated fields is that the values calculated for an InternalCalc field are stored and retrieved as part of the client dataset's data.
Choose OK. The newly defined calculated field is automatically added to the end of the list of persistent fields in the Field editor list box, and the component declaration is automatically added to the form's or data module's type declaration.
Place code that calculates values for the field in the OnCalcFields event handler for the dataset. For more information about writing code to calculate field values, see Programming a calculated field.
In OnCalcFields event handler you then need to implement asynchron loading of the picture.
I want to enable the user to enter a contact name in an data-aware edit control (combobox, edit) with autosuggest items bound to an sql table.
What I want to achieve is this:
a combo bound to Contact_Name field of a datasource,
an edit bound to Contact_Tel of same datasource
an edit bound to Contact_Email of same datasource
The combo dropdown should be bound to a sql datasource and display person name, phone number and email. The user can pick one of the existing options or type an arbitrary name (new contact person).
When the text of the contact person combobox changes, then
- if the text matches one of existing options, two other edit controls are filled with the phone number and email of the option selected, or
- if the text is not in list, the other two edit controls are cleared.
The set up that I currently have is
a dbLookupComboBoxEh bound to a field of a dataset + a listsource with key and listfields + style = csDropDownEh.
The problem is that it works fine when the user types in a value that is contained in the list source, but once I type in something that is not on the list the control simply gets cleared and doesn't remember the value any more.
Is there a control that combines a data-bound drop down with suggested values AND ability to enter ARBITRARY text?
I have created a master-detail relation using ClientDataSets (Service & Addons). The Services are displayed in a DBLookupComboBox (cboServices) and once a service is selected the Addons are displayed in DBGrid (grdMain).
The Addons has a checkbox to indicate the Addon is selected, a name field, a quantities field that the user can change, a unit price field and a total price field.
I have created a OnQuantityChange method to update the total price using the unit price and quantity but how do I get the actual data from the row to do the updating? How do I reference the various fields in order to do something like the following:
grdMain.GetActiveRow.Column['TotalPrice'] :=
grdMain.GetActiveRow.Column['UnitPrice'] * grdMain.GetActiveRow.Column['Quantity'];
You can do that easily using calculated fields. I suggest you look at the following article for a detailed example with client dataset. Just search the article for calculated fields, you will find what you need.
TClientDataset example