I am trying to build a table using the NorthWind - oData Service. where first column shows the customerIds and second column shows the companyNames.
Third column should display the count of orders of each company.
I would like to access the count using NorthWind - $count URL parameter.
That's not working, because the text attribute of the Text UI5 component doesn't seem support something like this:
<Text text="{Orders/$count}"/>
Could you help me out?
I already tried with a custom formatter, counting the arrays length and of course that's working. but I want to try to display the count without the need for a custom function. just using the $count parameter would be nice.
In V4 its quite simple, https://sapui5.hana.ondemand.com/#/topic/77d2310b637b490495d78b393ed6aa64
<Table id="SalesOrders"
items="{
path : '/SalesOrderList',
parameters : {
$count : true,
}
}"
>
<headerToolbar>
<Toolbar>
<content>
<Title id="SalesOrdersTitle" text="{$count} Sales Orders"/>
</content>
</Toolbar>
</headerToolbar>
...
</Table>
Related
So here's what I want to do. The following is the xml info (simplified) I get from an invoicing program. I would like to select the Invoicer Name for every time I have a different product. So in
my query I'd get:
Element='<invoicerName>Jack</invoicerName>'
Element='<invoicerName>Jack</invoicerName>'
Element='<invoicerName>Jack</invoicerName>'
Thank you!
<?xml version="1.0" encoding="UTF-8"?>
<invoices>
<invoice>
<invoicerInfo>
<invoicerName>Jack</invoicerName>
</invoicerInfo>
<invoiceDetails>
<productDescription>Soda</productDescription>
<productDescription>Popcorn</productDescription>
<productDescription>Tickets</productDescription>
</invoiceDetails>
<invoice>
</invoices>
I've tried a slew of options but I don't get repeated invoicerName values.
Google Sheets IMPORTXML seems to support XPath 2.0 so you should be able to use:
for $invoice in //invoice
return
for $p in distinct-values($invoice//productDescription)
return
$invoice//invoicerName
That'll generate a list of invoicerName nodes, one for each unique productDescription of a given invoice
If Google Sheets has support for group by you can also use
for $i in //invoice
let $name := $i//invoicerName
return
for $p in $i//productDescription
group by $p
return $name
here is the query in action with extended test data
https://xqueryfiddle.liberty-development.net/6qVSgfb
I'm making a simple java web app using spring boot and thymeleaf, it's about calculating the total amount of food's calories you eat. I completed the search food task. In selecting food task, in HTML file, i have object named user and food, however, i can not save the food's calories quantity which user click on it - actually i want to add the food calories just clicked to user.sumcalo
Can you give me some suggestions?
// This is a part of HTML code to show the database of searched food :
Code image
// This is a part of the script in above HTML file:
Code image
<script th:inline="javascript" >
/*<![CDATA[*/
function addCalo(x) {
var calo = [[${user.getSumcalo()}]] + parseInt(x) ;
document.getElementById("showCalo").innerText = "Calo =
"+ calo ;
[[${user.setSumcalo(calo)}]]; // -> This line has no
effect, i want to set user.sumcalo to calo
}
/*]]>*/
</script>
expected [[${user.setSumcalo(calo)}]] worked but it did not.
I have a page with 3 combos, 6 dependents inputs text ( if a special value is selected in combo, it will show, otherwise it will hide)
Then, I will have A text fields that is a computed property. Each time an input is changed, it will reevaluate this field value.
So, For instance, My fields are:
GradeIni, GradeFin, Category, AgeCategory, AgeIni, AgeFin , Gender (selects)
isTeam ( Checkbox )
CategoryFullName
So, for example, There is 5 predefines AgeCategory,and the 6th is Custom, when Selected, it show AgeIni and AgeFin
Each time a value is change, CategoryFullName is reevaluated.
My first answered question was how to get values from server.
I knew how to do it with Ajax, but in this case, it was easier to just use Server variable sent by Laravel when pages load.
So, the answer was 2 options:
#foreach ($grades as $grade)
<option ...>{{ $grade }}</option>
#endforeach
Or
<grades :grades="{{ $grades }}"></grades>
So, I would like to use the second one, but it means I have to create a component for each Select Option in my page, which seems a little heavy.
So, I'm a little bit confused about how should I make this page. Is it better by AJAX, is it better to be able to get data from laravel, and o make a component for each list, or is there a better way to do it????
You dont need to use many components. One component and one variable to keep the selected grade are fine.
You can create a component template to display all the grades.
I have created one template with dummy data to show you how you can do it.
<template id="grades-list">
Curently selected: Title {{selected.title}} Value: {{selected.value}}
<select v-model="selected">
<option v-for="grade in grades" :value="grade">{{grade.title}}</option>
</select>
</template>
The component should be registered like this:
Vue.component('grades', {
props: ['grades', 'selected'],
template: '#grades-list'
})
The tricky part is how you will select a default value and keep it synced with the parent. To do so, you can use .sync
<!-- you can use :grades="{{ grades }}" with Blade too-->
<grades :grades="grades" :selected.sync="selectedGrade"></grades>
To set default value you can update the selectedGrade variable when the document is ready, using vm.$set.
new Vue({
el: 'body',
data: {
'selectedGrade': ''
},
ready() {
this.$set('selectedGrade', this.grades[1])
}
})
I have created an example with dummy data here.
Consider the following code in your js file:
App.ApplicationRoute = Ember.Route.extend({
model: function(){
return this.store.findAll('team');
}
});
In your html file, you might have something like this:
{{#each model as |team|}}
<ul>
<li>{{team.name}}</li>
<li>{{team.email}}</li>
<li>{{team.state}}</li>
<li>{{team.position}}</li>
</ul><br>___<br>
{{/each}}
And the result would be something like
Bob Smith
bob.smith#bobsmithinc.com
NY
Leader
Jane Smith
jane.smith#janesmithinc.com
NY
Finance
John Doe
john.doe#janesmithinc.com
CA
Support
The question is, how would you go about sorting or filter this data after it's displayed? For example, if I want to sort by alphabetical order by name, or email, or lets say I only want to display someone in NY, and not CA.... or maybe type as I search, so if I type 'inc.com'... anyone that has that in their record will show?
My guess is this occurs in the controller via an Action? I just don't understand how to grab the store data (WITHOUT a network request) and resort or filter the data that's already there. I know you can use 'peek', but am unsure how to display the data.
to sort data in model you have to create new computed property in controller like so
sortedList: Ember.computed.sort('model', 'sortProperties'),
sortProperties: ['name:desc'], // properties to use for sorting
then in your template you can use it
{{#each sortedList as |team|}}
so then by modifying sortProperties to e.g. [state:asc] you are able to change sort order which can be in action handler
I am using BaseX as backend to store XML Files. Front end is in Java. I want to populate
certain elements data into a combobox. The output of the XQuery is string. I am facing problem to load this string in a combobox. Below is the XML file-
<Cities>
<City><C>London</C></City>
<City><C>New Delhi</C></City>
<City><C>Mumbai</C></City>
<City><C>Moscow</C></City>
<City><C>Tokyo</C></City>
<City><C>Mumbai</C></City>
<City><C>Tokyo</C></City>
<City><C>Mumbai</C></City>
<City><C>Tokyo</C></City>
<City><C>Mumbai</C></City>
<City><C>New Delhi</C></City>
</Cities>
Using this XML file, I want to populate all the distinct cities in a combobox. This will be done by following XQuery-
for $x in distinct-values(doc("City")/Cities/City/C)
return $x
The output of this is a simple string -
`London New Delhi Mumbai Moscow Tokyo`
There are 5 cities resulting from the query.
How can I populate this in a combobox..?
This might help:
element select {
distinct-values(doc("City")/Cities/City/C) ! element option { . }
}