npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

skaggr-spec

v0.0.5

Published

A JSON spec template for Qlik expressions

Downloads

5

Readme

skaggr-spec

A JSON specification for Qlik expression syntax

Motivation

QlikView and Sense developers are familiar with the Qlik expression syntax for calculating data in Qlik. For example, if we want to sum up a field called Sales, we simply write:

sum(Sales)

If we want to calculate that same value against the total data set rather than the current selections, we write:

sum({1} Sales)

If we want to get really crazy, we can add set modifiers to our set expression to produce complicated sets, like:

sum({$<Year = {2008,2009}>} Sales)

This syntax continues to scale up into more nested structures, faciliting precise control over our calculations. The syntax is notoriously difficult to learn, but it ultimately works well for an expression written by hand by a developer.

However, the creation and management of this syntax is not easily automated. *Enter the skaggr-spec.

The JSON Spec Template

skaggr-spec is a specification for defining the components of any Qlik expression via JSOn. With this template in place, we can start to build more tools for working with Qlik expressions, beyond the handcoding method we use today.

Here are the above examples, written according to the skaggr-spec format.

Example: Sum of Sales

sum(Sales)

becomes

{
    type: "aggr",
    value: "sum",
    parameters: [
        {
            type: "explicit",
            value: "Sales"
        }
    ]
}

While this JSON is harder to write by hand, it is much more easily parsed by code. Therefore, we can use it for automating Qlik expression management.

Example: Sum of Sales for the total data set

sum({1} Sales)

becomes

{
    type: "aggr",
    value: "sum",
    set: {
        type: "set-expression",
        components: [
            {
                type: "set-component",
                identifier: "1",
                modifiers: []
            }
        ],
        operators: [""]
    },
    parameters: [
        {
            type: "explicit",
            value: "Sales"
        }
    ]
}

Example: Sum of Sales for the Years 2008 and 2009

sum({$<Year = {2008,2009}>} Sales)

becomes

{
    type: "aggr",
    value: "sum",
    set: {
        type: "set-expression",
        components: [
            {
                type: "set-component",
                identifier: "$",
                modifiers: [
                    {
                        type: "set-modifier",
                        field: "Year",
                        forcedExclusion: false,
                        operator: "=",
                        selections: [
                            {
                                type: "set-list",
                                value: ["2008","2009"]
                            }
                        ]
                    }
                ]
            }
        ],
        operators: [""]
    },
    parameters: [
        {
            type: "explicit",
            value: "Sales"
        }
    ]
}