Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construct a list of values #28

Open
anatoly-scherbakov opened this issue Jul 2, 2020 · 3 comments
Open

Construct a list of values #28

anatoly-scherbakov opened this issue Jul 2, 2020 · 3 comments

Comments

@anatoly-scherbakov
Copy link
Collaborator

anatoly-scherbakov commented Jul 2, 2020

Suppose we want to join two columns.

version: 1
columns:
  greeting:
    - [
        value: "Our beloved client",
        input: title,
        input: first_name,
        input: last_name,
      ]
    - join: " "

We are facilitating the built-in YAML construct to make a list. I think this looks rather user-friendly.

@anatoly-scherbakov
Copy link
Collaborator Author

anatoly-scherbakov commented Jul 2, 2020

Support for lists allows us to use whole lot of list-oriented functions people are accustomed to. Examples:

- join: ", "
- range: [0, 3]
- filter: unempty
- map: strip
- reverse
- first
- last
- max
- min
- average
- sort

@anatoly-scherbakov
Copy link
Collaborator Author

How do we construct a list where one of the items requires a more complicated expression?

- [
    [
      - input: age
      - string
    ],
    value: "year(s)"
  ]

Something like this, I think.

@anatoly-scherbakov
Copy link
Collaborator Author

Now let's consider a real life example - splitting postal codes into two parts.

columns:
  zipcode_split:
    - input: zip_code
    - strip
    - replace:
      "-": ""
    - split-by-index: 5
    - hide
  zip5:
    - from: zipcode_split
    - index: 0
  zip4:
    - from: zipcode_split
    - index: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant