question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use nested data problem

See original GitHub issue

Is it possible to process my keys in moment? Need this for process nested data. I have template vars like this:

{user}
{user.name}
{user.age}

And data:

user: {
 name: 'Alex',
 age: 23,
 country: 'Ukraine'
}

And want result:

Alex, 23, Ukraine
Alex
23

I see three interesting features to resolve issue: first: add .toString method to object (user), that call when use {user} key in template (if object has toString, than ObjectCommandResultError not appear) second: add functions aliases, that calls additionalJsContext functions. like if i put {{{user}}}, than i get result of additionalJsContext.getByKey(key) third: if typeof data === ‘function’, that function receive ‘key’ parameter, and than can process it async and return result

At this moment i use this construction, but its to scared :DD. Template:

{v(`user`)}
{v(`user.name`)}
{v(`user.age`)}

Code:

additionalJsContext: {
      v: async key => {
          let fieldValue = calculateFieldValue(key, documentData)
          return fieldValue
      },
  },

And again as conclusion of 2 global problems:

  • i cant use object string representation and object nested fields at one time.
  • i must to know about all fields in template before render it. But i want to get needed data in moment, where i get key, and then put it into template

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mathe42commented, Feb 2, 2022

I’m also not shure what you want to do but with a Proxy you might be able to accive what you want - as you want to transform your data on the fly. But I would think transforming it before calling createReport is much simpler.

0reactions
jjhbwcommented, Feb 11, 2022

Hope this helped. If not, feel free to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with Complex and Nested Data
Nested data adds complexity to the data wrangling process of a dataset. The reason being, that it is not easy to consume in...
Read more >
Powerful Statistical Inference for Nested Data Using Sufficient ...
To address this issue, we review several approaches to deal with nested data, with a focus on methods that are easy to implement....
Read more >
Sampling and Nested Data in Practice- d h Based Research
Why are Nested Data a Problem? Research has shown that people within a particular Research has shown that people within a particular group...
Read more >
Analyzing Nested (Clustered) Data | Center for Large ...
There are two basic approaches to working with nested data: Adjust standard errors of individual-level predictors to account for the potential bias introduced...
Read more >
A Primer for Analyzing Nested Data: Multilevel Modeling in ...
This primer on conducting multilevel regression analy ses to address these issues using the Advanced Statistics module of SPSS IBM Statistics should be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found