We are using AG Grid React Enterprise with Adaptable.
When we filter on text columns we want to filter for exact matches only but the default seems to be Contains and its annoying for our users to have to remember to change it each time they run a filter and when they forget to do it they end up seeing false positives.
Is there some code we can run so that when the user enters filter text it will force the Grid to do a full match check?
You can set this at design time in SearchOptions where there is a defaultStringColumnFilter property.
The default value is 'Contains' which is why your users are seeing that, but you can change this to another Predicate. So if you want an exact match then set the value to 'Is'.
You can also set the default filters for Number and Date Columns from the current default values of 'Equals' and 'On' respectively. For example:
searchOptions: {
defaultStringColumnFilter: 'Is',
defaultNumericColumnFilter: 'GreaterThan',
defaultDateColumnFilter: 'After'
}
See more at Search Options documentation: https://docs.adaptabletools.com/docs/adaptable-options/search-options/
I've a form in a base QAD mfg/pro (ver 10.2) program. I know the names of form, frame and fields. I'dont have access to base program's code modification. I've a wrapper program that access various fields from the existing form using handles, first-child, next-sibling etc.
What I want to do is to add a fill-in into this form/frame from the wrapper program and during runtime, take user input into that field.
I've been able to create text (for label) and fill-in field (called user) in the frame, however, the field is in't enabled.
create fill-in txt_user
assign
name = "txt_user"
row = 7
column = 19
frame = hWidget
visible = true
side-label-handle = lbl_user.
How can I enable the fill-in field txt_user and take input in it?
To Enable the field set the SENSITIVE property to TRUE. To query the current value, read the INPUT-VALUE property.
I have a lot of objects with unique IDs. Every object can have several labels associated to it, like this:
123: ['a', 'hello']
456: ['dsajdaskldjs']
789: (no labels associated yet)
I'm not planning to store all objects in DynamoDB, only these sets of labels. So it would make sense to add labels like that:
find a record with (id = needed_id)
if there is one, and it has a set named label_set, add a label to this set
if there is no record with such id, or the existing record doesn't have an attribute named label_set, create a record and an attribute, and initialize the attribute with a set consisting of the label
if I used sets of numbers, I could use just ADD operation of UPDATE command. This command does exactly what I described. However, this does not work with sets of strings:
If no item matches the specified primary key:
ADD— Creates an item with supplied primary key and number (or set of numbers) for the attribute value. Not valid for a string type.
so I have to use a PUT operation with Expected set to {"label_set":{"Exists":false}}, followed (in case it fails) by an ADD operation. These are two operations, and it kinda sucks (since you pay per operation, the costs of this will be 2 times more than they could be).
This limitations seems really weird to me. Why are something what works with numbers sets would not work with string sets? Maybe I'm doing something wrong.
Using many records like (123, 'a'), (123, 'hello') instead of one record per object with a set is not a solutions: I want to get all the values from the set at once, without any scans.
I use string sets from the Java SDK the way you describe all the time and it works for me. Perhaps it has changed? I basically follow the pattern in this doc:
http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_UpdateItem.html
ADD— Only use the add action for numbers or if the target attribute is
a set (including string sets). ADD does not work if the target
attribute is a single string value or a scalar binary value. The
specified value is added to a numeric value (incrementing or
decrementing the existing numeric value) or added as an additional
value in a string set. If a set of values is specified, the values are
added to the existing set. For example if the original set is [1,2]
and supplied value is [3], then after the add operation the set is
[1,2,3], not [4,5]. An error occurs if an Add action is specified for
a set attribute and the attribute type specified does not match the
existing set type.
If you use ADD for an attribute that does not exist, the attribute and
its values are added to the item.
When your set is empty, it means the attribute isn't present. You can still ADD to it. In fact, a pattern that I've found useful is to simply ADD without even checking for the item. If it doesn't exist, it will create a new item using the specified key and create the attribute set with the value(s) I am adding. If the item exists but the attribute doesn't, it creates the attribute set and adds the value(s). If they both exist, it just adds the value(s).
The only piece that caught me up at first was that the value I had to add was a SS (String set) even if it was only one string value. From DynamoDB's perspective, you are always merging sets, even if the existing set is an empty set (missing) or the new set only contains one value.
IMO, from the way you've described your intent, you would be better off not specifying an existing condition at all. You are having to do two steps because you are enforcing two different situations but you are trying to perform the same action in both. So might as well just blindly add the label and let DynamoDB handle the rest.
Maybe you could: (pseudo code)
try:
add_with_update_item(hash_key=42, "label")
except:
element = new Element(hash_key=42, labels=["label"])
element.save()
With this graceful recovery approach, you need 1 call in the general case, 2 otherwise.
You are unable to use sets to do what you want because Dynamo Db doesn't support empty sets. I would suggest just using a string with a custom schema and building the set from that yourself.
To avoid two operations, you can add a "ConditionExpression" to your item.
For example, add this field/value to your item:
"ConditionExpression": "attribute_not_exists(RecordID) and attribute_not_exists(label_set)"
Source documentation.
Edit: I found a really good guide about how to use the conditional statements
As a bonus to the project I'm currently working on, the people would like it if I could change the background color of individual table cells depending on what their value is. So in the RadGrid_ItemDataBound event handler I have, I'm trying to set the BackColor of the cell if the cell's text equals a certain value from a dataset in my database. My current code is like so:
For i As Integer = 0 To ds2.Tables(0).Rows.Count - 1 Step 1
If tc.Text = ds2.Tables(0).Rows(i)("LookupValue") Then
tc.BackColor = ds2.Tables(0).Rows(i)("Ref1")
Exit For
End If
Next
The problem is when setting a color in the code-behind, I apparently have to set it to an object of System.Drawing.Color -- I can't just feed it a string value like I can in CSS. So in the code snippet I've posted above, my code throws a runtime exception on tc.BackColor = ds2.Tables(0).Rows(i)("Ref1"). I've also discovered that I can't use CType to change a string value into an equivalent object of System.Drawing.Color .
I've thought of a solution that I COULD use. I could create a custom object that has a Name property and a System.Drawing.Color property. I could instantiate several objects according to all color values available in the database and then compare the cell text against the objects' Name properties, however I fear doing this will be rather resource-intensive (and this application's performance is already taking a hit because it has to run under IE7).
So does anybody know of a way I could pull off what I need to here in a relatively simple, non-resource-intensive fashion?
Color.FromName() handing it the name in your database. There are also other methods like FromRGB, but FromName sounds like what you want.
http://msdn.microsoft.com/en-us/library/system.drawing.color.fromname.aspx
I have a datagrid that uses an array of objects as the data provider. The objects are essentially key/value pairs:
{ foo:"something"}
{ bar:"hello"}
{ caca:"lorem"}
The datagrid has 2 columns. The first column is the key and the second column is the value. Right now my grid looks like:
My dataFormatter function makes sure that depending on the column (i.e. the dataField value) the correct key or value gets printed out. This works fine for displaying. However, as soon as I try and edit the value field it essentially adds a new value into the object with a key of '1'. For example, if I edit the {caca:"lorem"} object it will then contain the value {caca:"lorem",1:"new value"}.
Is there any possible way I can set the DataGridColumn so that when I edit a value it will update the value associated with the key rather than inserting a new value? I've tried using a custom item editor but it still does the insert. It seems like I need to be able to update the 'dataField' with the actual key value but I'm not sure how to do that.
Looks like you need to think about where your data is going to be stored. I would recommend listening for a CollectionEvent.COLLECTION_CHANGE event on your data model. That event object will contain info about what change occurred, and you can make any updates you need to make.