Clearing attributes in Tritium - attributes

What's the best way to clear all attributes of an element with Tritium? Do I have to enumerate all existing attributes with attribute(%name, "") ?

The best way is to use the remove function by itself after selecting an item.
remove("#*")
You could even select the node first
remove("//node/#*")

Related

Ignore ID in Attribute Selection

I have a dataset with an unique id for each instance. Now I am running some Attribute Selection on that dataset. Concrete I use the CfsSubsetEval for selecting the relevant attributes.
The problem is that I don't want to include the id in this attribute selection, but I need it later to write out a .arff File (which should contain the id and the selected attributes).
I found some posts which used the FilteredClassifier. But in my case I want to have something like a FilteredAttributeSelection. Something like an exklusive view on the data for the AttributeSelection Algorithm.
Is there a way solving this problem?
Thanks in advance!
I solved the problem by copying the attribute vector (the ids) before the filter. After selecting the attributes I restore it.

Hide refrence search action on Openxava, How To?

I need to display all item in my view readonly except one field and between all field there is one reference field and I would like to hide the reference search action of that field in openxava. How can i do it? If it's not possible, then how to simulate that?
Annotate all the elements you want read only with #ReadOnly.
You can also do it programmatically from a on-init action using getView().setEditable("memberName", false)

Formula referencing parent doc works in computed field, not as default value

Following on from this question: Referencing parent field on document creation I'm using the formula for the default value for a name field.
IfError(#IfError(#GetDocField($ref;"ProductFamilyManager");
#GetDocField(ParentUNID;"ProductFamilyManager"));
"")
This works when it's a computed field, but not when i change it to be editable with a default value formula.
Any ideas how I can get the field populating with the default value?
The best way of doing this is to use #InheritedDocumentUniqueId. You need to enable inheritance to make that function available, but you don't actually have to inherit any of the parent values.
You should definitely not have to be using two different techniques and #IfError to get this done. And btw: did you know that #IfError is obsolete as of Domino 7?
It may not be supported but just to be sure, has the parent doc been saved before you create the response doc?
Assuming that's not the problem, the alternative is to use the "inherit field values from parent doc " option, which will pass a value from the parent doc to the response doc on creation. I may have the wording wrong but the option is on the form properties dialog in Designer.

How to change ElementTree attribute keys?

I want to change the attributes of an existing element, and not just the values, but add/remove/change the keys too. For example,
<frame_geometry name="border" has_title="false"/>
I would like to add: rounded_top_left="5" etc...
Is modifying element attributes' keys after creation possible?
If not, perhaps I could use a workaround, something like storing all the element's attributes in a temporary dictionary and then creating a new element from that +/- any desired changes?
This solution is not desirable however because the elements I need to modify have several subelements also...
I figured it out. So simple.
Add new attribute:
element.attrib['newkey'] = 'newvalue'
will add an attribute to existing element.
To remove an existing attribute:
del element.attrib['unwanted_key']
As far as modifying existing keys, I still don't know if that's possible, but with add/remove you can easily work around.
I've had success by iterating through the elements I was hoping for a .rename style function
For element in XMLData:
if element.tag = Searching:
element.tag = "NewTag"
#Now its element.NewTag

NSArrayController that is sorted and unique (no duplicates) for use in a pop-up in a core-data app

I have core data app with an entity OBSERVATION that has as one of its attributes DEALNAME.
I want to reference through Interface Builder or by making custom modifications to an NSArrayController a list of unique sorted dealnames so that I can use them in a pop-up.
I have attempted to use #distinctUnionOfSets (and #distinctUnionOfArrays) but am unable to locate the proper key sequence.
I can sort the ArrayController by providing a sort descriptor, but do not know how to eliminate duplicates.
Are the #distinct... keys the right methodology? It would seem to provide the easiest way to optimize the use of IB.
Is there a predicate form for removing duplicates?
Or do I need to use my custom controller to extract an NSSet of the specific dealnames, put them back in an array and sort it and reference the custom array from IB?
Any help would be appreciated. I am astounded that other have not tried to create a sorted-unique pop-up in tableviews.
You need to take a look at -[NSFetchRequest returnsDistinctResults]. That is the level you need to be handling the uniquing of data.
Although I do not have a definitive answer for you, I think there are two ways you can go about it.
The way you already started. You need to bind the contents array of the PopUp button, not just against the arrayController.arrangedObjects, but continue on the path and somehow filter only objects with distinct "DealName"s. This means - the arrayController presents ALL the entities (and may sort them for you) but the PopUp button will have its contents filter via some sophisticated binding to the array controller.
Make your filtering at the ArrayController level (as suggested in another answer here). Here it depends how you set up the array controller. If It is set up to use an "Entity" (vs. "Class") which means the array controller will fetch CoreData entities directly - you can modify its "Fetch" to only bring a subset of the "OBSERVATION" entities with distinct values of "DEALNAME". I don't know how to control WHICH entities are filtered out in this case. Otherwise, you can setup the arrayController to work with "Class" objects, and then you can fetch the entities yourself (in code) and populate the arrayController programmatically, with just the entities you like.
In the second option, the Popup button should be bound normally to the arrayController's arrangedObjects.

Resources