Skip to content

OL-7 NestedLoops Example#14

Open
RickyAmparoCloud wants to merge 1 commit intomasterfrom
OL-7
Open

OL-7 NestedLoops Example#14
RickyAmparoCloud wants to merge 1 commit intomasterfrom
OL-7

Conversation

@RickyAmparoCloud
Copy link
Contributor

I added the Doctor, UI versions as well as the ReadMe.

Copy link
Contributor

@kiawnna kiawnna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickyAmparoCloud WOW. I found a couple very small (possibly unnecessary) changes. I'm sure Nick will have more to say ;) Great job!

1. Insure you have the latest non-beta version of the doctor installed via npm. You can follow the directions found [here](https://www.npmjs.com/package/ce-util) or run the command `npm install -g ce-util`. You'll need a version of node that is >= v6.3.0. You will need to upload the file from TheDoctor directory, as files uploaded with the doctor have a different structure than files imported via UI.
2. From the TheDoctor directory, run the command:
```
doctor upload formulas <acctNickName> -f nestedLoops.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickyAmparoCloud It likes like you've called the formula "formula.json" in the doctor folder. I think you'll either have to rename it or change this line to refer to "formula.json" instead of "nestedLoops.json".

arr.push(steps.loopThroughInvoiceLines.entry.amount)

done({
arr: arr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickyAmparoCloud @nick-bair I'll let Nick confirm but I want to say you don't need "arr:arr" inside of the done callback. Instead you can just pass in done ({ arr });

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct.

* "How should I setup a loopstep from within another loop and aggragate data from the nested loop?"

## Solution:
You will need to call the primary loop as the on failure branch of the nested loop. You will then need top use the standard aggregator approach to maintain the data from the nested loop. This approach is outlined below:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickyAmparoCloud "top" should be "to" ;)

@@ -0,0 +1,3 @@
let pageInfo = {"pageSize": 3}

done({"pagination":pageInfo}) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickyAmparoCloud Not sure it matters much, but I think you can pass in done({ pageInfo }) and just refer to .pageInfo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends how you pass it to done:

done({ pageInfo }) => access later by calling stepName.pageInfo
done(pageInfo) => access later by calling stepName

@nick-bair
Copy link
Contributor

@RickyAmparoCloud looks great! All the feedback I have is nitpicky, so take it with a grain of salt.

  • In makePaginationQuery maybe add a comment to explain setting the page size low for testing
  • In aggregator will every line item be guaranteed to have an amount? (I'm guessing yes, but worth double checking)
  • Semicolons - I would either add semicolons to all EOL for JS or remove the couple you have for consistency

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

Successfully merging this pull request may close these issues.

3 participants