How to select specific object index in Handlebars - object

So far, I have #each looping over an array of products
{{#each category.products}}
// looping over products
{{/each}}
I am displaying these products as a grid. Is there a way to grab the third element and insert a div or something? I know #first and #last can grab the first and last iterations, but what about grabbing a specific index?

Related

Is there a vbo to get value from a collection based on value of other fields and save it as a data item?

Relatively new to Blue Prism,
I have a collection that looks like this, with 100+ rows:
Results
Answer
Timestamp
8 Apr 2021
Name
ABC
I'd like to manipulate the data such that if Results = 'Name', Get the Answer (aka ABC) and put it into a data item.
Is there any way to do this?
I understand I could hardcode i.e. Get value based on Row Index and Column Index, but my data is complex and may not always have the same rox index.
Can you use the collection filter to get a collection output? The utility has an action to filter where you can input a collection and then use
[FieldName] Like "some value"
This would result in every complete row in the collection that matches the filter.

Macro to list all documents field value only select list

I am trying to list all items in a section of Kentico as a drop-down list but want only one field value to be returned for each document.
What I have tried
Lists Nothing:
Documents.WithAllData["/Foo/Bar/Bar"].AllChildren.WithAllData.All.GetValue("FooBar")
Lists all document information:
Documents.WithAllData["/Foo/Bar/Bar"].AllChildren
You'd use a macro similar to this:
<select id="ddlItems">
{% Documents["/Foo/Bar/Bar"].Children.WithAllData.ApplyTransformation("cms.event.transformationname") %}
</select>
To list out all your items. The transformation will then have your column information:
<option>{% FooBar %}</option>
**** UPDATE ****
Based on your comment, you can simply use a sql query (which a macro will run anyway). If you know what page type you want to query you can go directly to that page type's table:
SELECT Col1, Col2, FROM Content_YourTable
If you need the data from your page type based on a particular path in the tree, then you can use something like this:
SELECT Col1, Col2
FROM View_CMS_Tree_Joined
INNER JOIN CONTENT_MenuItem on DocumentForeignKeyValue = MenuItemID
WHERE NodeAliasPath like '/Foo/Bar/Bar/%'
AND Classname = 'cms.menuitem'

Sorting word table items with sub items

I have list in MS Word table.
Items have subitems, each in separate row. Each subitem have indentation.
I need a way to sort this only items in this list, subitems should move with them.
I have same list in Excel also but I didn't manage to do much with it there too..
Let's call each item parent, each subitem child. Then following algorithm can be helpful.
Give to each parent id
To each child assign it's parent id
Sort Parents.
Display hierarchy again.
My understanding of task:
item 1
subitem1a
subitem1a1
subitem1a2
subitem1b
subitem1c
item 2
subitem2a
subitem2b
Suppose you want to sort it by descending, and displayed list should be presented like this:
item 2
subitem2a
subitem2b
item 1
subitem1a
subitem1a1
subitem1a2
subitem1b
subitem1c
Am I correct?

Sum specific list items and assign the sum value into a different list

Alright, here's my scenario :
I have 2 custom lists : Orders and Items. The Items list contains a field Description (text) and a Amount Per Item field (calculated). The Orders list contains a Total amount field and a Items field (lookup on the description field in items which allows multiple values selection).
Here's a more visual explanation :
Orders
Total amount
Items (lookup on the description field in items which allows multiple values selection)
Items
Description (text)
Amount per Item
I would like to do the sum of the Amount per Item field of the selected items from the Items lookup field from Orders and put the value of the sum in the total amount field in Orders
Any suggestions? Is it possible to do this in SharePoint 2010 without code? If not, could you show what the code would look like?
Thanks.
You could try
OrderList.Total = OrderList.Items.Sum(item => item.AmountPerItem);

How do I get the contents of a selected row from a YUI datatable?

I'm trying to get the contents of a cell in a row in a YUI datatable.
I can use myDataTable.getSelectRows()[0] to get the first selected row. However, how do I get the contents of the first cell in that row?
It looks like getSelectRows() returns an array of record IDs. You can retrieve the corresponding record using getRecord(). Once you have a record, use getData() to retrieve the value of the field you are interested in.
var recordID = myDataTable.getSelectRows()[0],
record = myDataTable.getRecord(recordID);
console.log(record.getData("myField"));
http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getRecord
http://developer.yahoo.com/yui/docs/YAHOO.widget.Record.html#method_getData
I think I may have the answer for you assuming you have not already found it yourself.
I have the same kind of page with a datatable and a textarea field, when you select a row in the datatable calls the same page displays further detail from the selected row in the textarea field and retains selection of the selected row.
1: To do this I apply the following example MySQL query called AllMyBroadcasts...
SELECT #rownum :=#rownum + 1 RowNumber, p.*
FROM tblBroadcasts p, (SELECT #rownum := 0)r
ORDER BY Date DESC
the tblBroadcasts table has fields : Date, Narrative, ID
2: I then provide the following to the table row of my YUI Datatable within HTML hyperlink tags.
href="MyPage.php?SelectedBroadcastID=' .$row_Broadcasts['ID'].'&RowNumber=' .($row_Broadcasts['RowNumber'] -1 )
3: When the href is clicked MyPage reload with additional parameters SelectedBroadcastID and RowNumber the SelectedBroadcastID I use in a second query against tblBroadcasts called MySlectedBroadcast which a simple query on outputting all fields where the ID = SelectedbordcastID. I then to my field to display the narrative of my selected row in my textarea field.
The second paramater I do the following with.
$SelectedRowID = 0;
if( isset($_GET['RowNumber'])) {
$SelectedRowID = $_GET['RowNumber'];
}
Above I placed just after code covering my two queries.
4: Then finally to get the datatable to select the row of the selected row I include the following to the var yuidatdatable section of the datatable script...
yuidatatable1.select(yuidatatable1.getRow());
The -1 value referred to step 2 serves as a work around to fact that yuidatatable works on a 0 base and the MySQL referred to in step 1 on a 1 base.
There you go !
Perhaps there is a better why using get from within YUIDatatable scripting, be nice to know if so. That said this work fine for me and perhaps if you have not found an answer I hope this helps.

Resources