Umbraco 7 Multinode Treepicker xpath query root node parent of parent - xpath

I have Multinode Treepicker in Umbraco 7.4.1.
I'm trying to find out how to set the picker to start from the parent of the parent of my current node.
I'm also need the option to set the picker to start from the siblings of the parent of my current node.
I tried to use:
$parent/$parent
or
$parent/parent
or
../
no success...
Thanks in advance for all helpers!

hr_117 found the answer !
$parent/..
thank's

You can also use xpath filters like ancestor-or-self, etc and use filters like [self::type] to find what you want.
So if you want to find an ancestor which is a homepage you can write:
$current/ancestor-or-self::*[self::homepage]

Related

Neo4jRB: updating node data?

Looking at ActiveNode's persistence.rb, it seems like there's no update() or equivalent. How does one update the data of a particular node?
update comes from Neo4j::Shared::Persistence, not ActiveNode. You can find it here.

How to correctly add constraints to the querybuilder node for CQ5 Reports

I'm working on creating a custom report report page in CQ5. I've got my reportbase and columnbase components set up correctly, by following the steps listed here. I am able to, for instance, pick up all the templates that are available, by setting the property nodeTypes to cq:Template
I want to add a constraint to it, say for example pick up templates whose jcr:title is foo. I created a node under querybuilder called propertyConstraints and added my constraints in the form of nodes below it, as describedhere. However, this does not work for me at all.
What is the correct way to add constraints to the querybuildernode? Has anyone tried this?
Also, once I get this working correctly, can I extend this example to return pages of a specific template?
Have you looked into the QueryBuilder API? Adobe's documentation discusses how to match 1 or more property values.
Create a node propertyConstraints under queryBuilder of type nt:unstructured
create another node under propertyConstraints with any name.
Add properties to this node :
name String jcr:title
value String foo

how to add for loop with spark view engine

Is there a way to add a for loop when using spark view engine ?
I'm trying to add pagination support to my view and trying to loop through and add list entries listed below:
<li>1</li>
<li>2</li>
Unfortunately all I can find are examples to use foreach. Is there way to do this in spark ?
I guess the only thing a for loop would give you over a foreach is the index of the current item (well, that and obviously being able to control the size of iteration increments), but in Spark we provide the index of the current item so that you can use it like this:
<for each="var thingy in Model.Thingies">
<div>Item ${thingyIndex} of ${thingyCount}</div>
</for>
No direct way, but several indirect methods are listed in this page:
https://groups.google.com/forum/#!searchin/spark-dev/for$20loop/spark-dev/vfUUg2KUFk4/yqJ4iRUNYC4J

Getting a level of an ALV tree node?

I created an ALV TREE report, using cl_gui_alv_tree, that has 3 levels. I'm also implementing an event handler for when he double clicks a node.
My problem is that I want to take some actions only when he double clicks a node that is a root node. The event 'node_double_click' gives a node_key, but that's the index of the displayed table. How could I achieve this?
The node ID is not an index, it's the ID you assigned to the node when adding it to the tree.
If possible, I'd suggest switching to CL_SALV_TREE - not only because it is documented
and supported by SAP, but also because it comes with some query methods that are quite handy. These methods are documented as well. You can use, for example, GET_NODE to retrieve a node by its ID and then use GET_PARENT to check whether the node in question is a top-level node or has a parent node it is attached to.
I created a pattern for myself, which i am using.
lv_parent1 = node_key.
while lv_parent1 ne go_Main_tree->C_VIRTUAL_ROOT_NODE.
CALL METHOD go_main_tree->get_parent
EXPORTING
i_node_key = lv_parent1
IMPORTING
e_parent_node_key = lv_parent1.
lv_hierlevel = lv_hierlevel + 1 .
ENDWHILE.
if lv_hierlevel > 2.
“ do what You want to do
endif.

Umbraco: how can i get a node by property value with uQuery?

Maybe someone can help, is it a way to combine an xPath expression to query node by it's property value?
I have a node with custom property "ItemId". I need something like this:
uQuery.GetNodesByXPath("//* [#itemId = '<someId>']")
Thanx in advance!
"//*" Will give you all nodes, so "//*[#itemId = '<someId>']" is asking to give you all nodes with an attribute equal to exactly "<someId>", which you can't have as a valid attribute.
So, if you have <myNode someId='my Id value'></myNode> , then try //*[#itemId='someId']
But remember, this will give you ANY node with that particular attribute ID.
I'm not sure if this is what you're looking for, but please post your XML or a snippet of what you're grabbing, as that will clear up any grey areas.

Resources