Getting windows-8 semantic zoom out to include empty items - windows-8

I understand providing the data template to the ItemTemplate selector, but the items that I want to be displayed are not part of the data. For instance let's say you have the following list of children in the classroom:
Mark Anderson
Sara Buckingham
Dave Christy
Jeni Thompson.
and are using the first letter in the last name to organize the data. If I pass dataItems that represent the students (FirstName, LastName) to the groupedItemList
'groupedItemList = itemList.createGrouped(
function getGroupKey(dataItem) {
return dataItem.LastName.toUpperCase().charAt(0);
},
function getGroupData(dataItem) {
return {
Name: dataItem.LastName.toUpperCase().charAt(0)
};
},
function compareGroups(left, right) {
return left.toUpperCase().charCodeAt(0) - right.toUpperCase().charCodeAt(0);
}
),`
The semantic zoom out contains only the following letters
A, B, C, T.
I would like a list of all the letters in the alphabet and then style them so that those letters that have no items get another visual treatment.

After spent some time trying to find the solution to the same problem, I have have found a solution and posted it on gist.
https://gist.github.com/pimpreneil/4714483
Hope it is clear enough.

Related

Power Automate Flow to get specific cells based on user input

I am currently working on a Microsoft Power Virtual Agent (PVA) chatbot that helps users understand complicated documents. Right now I am looking at making a flow that takes a user's zipcode as input and then returns a departments contact information from a Sheet. I am firstly not sure what the best solution is, I am using 'get rows' on a Google Sheet, but I am not sure if I should be using a Sharepoint list instead.
My real issues are the following:
How do I get the right row out based on the zipcode a user provides? So if I give it 2000 as a Zipcode in PVA and turn that into an input for the flow, how does it run through the rows in a sheet and find the right one dynamically, then how do I select that row and turn the other cells that are part of it into variables? I tried to use control loops but could not get that to work right.
I've added a pic here of what I currently have
Try this and see how you go.
I created an Excel document that stores your zip codes. You need to store it in a SharePoint online folder, mine looks like this ...
You'll notice that in Excel Online (hopefully you have this, if not, it's a tenancy thing that needs to be activated) you'll have a tab in the ribbon called Automate ...
In there, create a new script, call it Zip Code Lookup and then paste in this code ...
function main(workbook: ExcelScript.Workbook, zipCodeToFilter: string)
{
let activeSheet = workbook.getActiveWorksheet();
let zipCodeRange = activeSheet.getUsedRange();
let zipCodeValues = zipCodeRange.getValues();
let zipCodeFilter = zipCodeValues.filter(row => {
return row[0].toString() == zipCodeToFilter;
});
let zipCodeResult: ZipCode = null;
if (zipCodeFilter.length == 1) {
zipCodeResult = {
zipCode: zipCodeFilter[0][0].toString(),
phoneNumber: zipCodeFilter[0][1].toString(),
departmenName: zipCodeFilter[0][2].toString(),
website: zipCodeFilter[0][3].toString()
}
}
return zipCodeResult;
}
interface ZipCode {
zipCode: string,
phoneNumber: string,
departmenName: string,
website: string
}
Now in PowerAutomate, you should be able to include an action called Run script which is a part of the Excel Online (Business) group of actions.
Here is an example of what I have configured. Specifically, I'm going to look up zip code 53478 ...
... then when the script runs, you get this output and all of the variables are split out for future use.
So I can set the department name into a new variable if I need to (but you don't because it's already a dynamic property) ...

Merging data from different graphql resolvers in vue.js client side for simple outputting

I do query cars from an api with a single query but two resolvers (listing and listings)(hopefully resolver is the right name for it). One car I get by the id via listing and the other cars I get without filters by listings. The resolvers output the data i a little different structure on the server-side but I do get the same fields just at different „places“. I want to merge the structure in order to get a single array I can simply loop over in vue.js. For the apicalls I do use vue-apollo.
Couldn't find any information to merge data client-side inside graphqlqueries. All I found is about handling it serverside with resolvers but it's an api I do not own.
Is it possible with graphql or do I have to merge it inside my vuecomponent and if so what would be the best way to do so?
The output will be a grid of cars where I show the car of the week (requested by id) together with the newest cars of the regarding cardealer.
Full screenshot including response: https://i.imgur.com/gkCZczY.png
Stripped down example with just the id to show the problem:
query CarTeaser ($guid: String! $withVehicleDetails: Boolean!) {
search {
listing(guid: $guid){
details{
identifier{
id #for example: here I get the id under details->identifier
}
}
}
listings( metadata: { size: 2 sort:{ field: Age order: Asc}}) {
listings{
id #here it's right under listings
details{
…
}
}
}
}
}
}
Ideally you're right, it should be handled server-side, but if it's not your API the only solution is to manipulate the data on the client side, meaning in your component.
It's probably a lot simpler to leave the listings array untouched and to just merge the listing element with it, like this for instance:
// assuming 'search' holds the entire data queried from the api
const fullListing = [
// car of the week, data reformatted to have an identical structure as
// the 'other' cars
{
id: search.listing.details.identifier.id,
details: {
vehicle: search.listing.details.vehicle,
},
},
...search.listings.listings, // the 'other' cars
]

How to insert an item into a sequence using Sequelize, or How to manage an ordering attribute

I have an entity with a sequence attribute, which is an integer from 1-N for N members of the list. They are polyline points.
I want to be able to insert into the list at a given sequence point, and increment all the items at that point or beyond in the sequence to make room for the new item, and likewise if I delete then decrement everything above so we still have nice sequence ordering with no missing numbers.
There is a REST interface in this of course, but I dont want to hack about with that, I just want sequelize to magically manage this sequence number.
I am assuming I need to get hold of some "before insert" and "after delete" hooks in sequelize and issue some SQL to make this happen. Is that assumption correct or is there some cooler way of doing it.
I havent tested this, but this appears to be the solution, which is barely worth comment.
I know the modelName, and name==the attribute name,
options.hooks={
beforeInsert: function(record, options) {
return self.models[modelName].incrementAfter(name,record[name]);
},
afterDelete: function(record, options) {
return self.models[modelName].decrementAfter(name,record[name]);
}
}
and then added to my extended model prototype I have
incrementAfter:function(field,position){
return this.sequelize.query("UPDATE "+this.tableName+" SET "+field+" = "+field+"+1 WHERE "+field +" >= "+position);
},
decrementAfter:function(field,position){
return this.sequelize.query("UPDATE "+this.tableName+" SET "+field+" = "+field+"-1 WHERE "+field +" >= "+position);
},

How to find Trello ListId's or CardId's with Trello.NET

I'm trying to find all cards in a specific list using Trello.NET
In the examples given it's clear to to find all list names in a Board, and all Cards in a Board. However if I want to find all Cards in a specific List, as far as I can see I need ListID (can't filter by List Name) by using trello.Lists.WithId()
Knowing the List name, how can I determine what it's ListId is so I can subsequently filter for all Cards in it?
And if I would subsequently like to edit an existing Card, how can I determine the CardId.
Use LINQ and filter in-memory:
// More than one list can have the exact same name, this finds the first:
var list = trello.Lists
.ForBoard(board)
.FirstOrDefault(list => list.Name == "name of the list");
if (list != null)
{
var cards = trello.Cards.ForList(list);
// ...
}
You could use a similar technique to find a card if you know it's name: use trello.Cards.ForBoard or trello.Cards.ForList first, and then filter by name afterwards.
For cards there is another option though: trello.Cards.Search. For example:
var cards = trello.Cards.Search("name of the card");
The search will be performed on the server in this case.

Extract Drupal encoded data using MySQL from Ubercart table

I am writing an integration piece between Drupal/Ubercart and a in-house admin system.
The customer uses Ubercart products with attributes (e.g. a Plaque, which can contain a name, a company, a registration date and month). When an order is placed, the values entered for the attributes are written to uc_order_products, where the data field contains the actual values entered by the user. As far as I can tell, this is the only place where product attributes values, as entered by an end user to place an order, is stored.
The encoded attribute values uses a format seen all over Drupal tables to encode objects:
a:3:{s:10:"attributes";a:4:{s:26:"Name (to appear on plaque)";a:1:{i:0;s:10:"Some
Namee";}s:7:"Company";a:1:{i:0;s:28:"Some Company Name Goes here_";}s:19:"Certification
Month";a:1:{i:0;s:0:"";}s:18:"Certification Year";a:1:
{i:0;s:4:"2011";}}s:9:"shippable";s:1:"1";s:6:"module";s:10:"uc_product";}
And expanded, it looks like this:
a:3:
{
s:10:"attributes";
a:4:
{
s:26:"Name (to appear on plaque)";
a:1:
{
i:0;
s:10:"Some Namee";
}
s:7:"Company";
a:1:
{
i:0;
s:28:"Some Company Name Goes Herep";
}
s:19:"Certification Month";
a:1:
{
i:0;
s:0:"";
}
s:18:"Certification Year";
a:1:
{
i:0;
s:4:"2011";
}
}
s:9:"shippable";
s:1:"1";
s:6:"module";
s:10:"uc_product";
}
I there a simple way to get to the individual field values within this text using SQL? I can write a SQL function to go look for specifics, but I'd like to know if someone knows of an existing MySQL approach (perhaps within Drupal) which would do this.
Thanks!
That's a serialized array, meaning data that was processed by PHP's serialize() function before Drupal inserted it into the database. Use the opposite function unserialize() to turn that string back into an array.
Don't know if any built-in solution exists, but I ended up writing a SQL Function which takes as parameter text such as Name (to appear on plaque). The function then locates the text and extracts the succeeding { ... } block and from it retrieves the corresponding string value. Rough, but works in this case.
If someone has a better solution, I'd like to hear about it!