Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel1

...

Generic Logic

Create a PB Feeder generic feeder logic that emits the quote Quote objects for use in the PA Analytics logic:

Paste code macro
def quotesRecieved = true
int i = 0
int step = 200
def qs = []
def quotes = []
while (quotesRecieved) {
  // lastRunTime - last run time of the Data Load. For the first run, it should be an old date which includes all the quotes.
  qs = api.find("Q", i, step, null,
                Filter.greaterOrEqual("lastUpdateDate", lastRunTime))
  if (qs.size() != 0) {
    quotes += qs
    i += step
  } else {
    quotesRecieved = false
  }
}

for (q in quotes) {
  if (q?.id != null) api.emitPersistedObject("Q", q.id)
}

...

Analytics Logic

Retrieve the target rowset from the Datamart:

Paste code macro
languagegroovy
def targetRs = api.getDatamartRowSet("target")


Fetch the quote Quote from the feeder logic:

Paste code macro
languagegroovy
def quote = api.currentItem()

...

Fetch header inputs/output values from the quoteQuote:

Paste code macro
languagegroovy
def clic = api.getCalculableLineItemCollection(quote?.typedId)
for (input in clic?.inputs) {
  if (input.name == "OpportunityType") {
    opptyType = input.value
    continue
  }    
}

for (output in clic?.outputs) {
  if (output.resultName == "Country") {
    country = output.result
    continue
  } 
}

...

Fetch line-level inputs/output values from the quote Quote (you can use api.getCalculableLineItemResult to fetch line-level outputs):

...


Create logic elements for each Datamart field. Return the global variables in each logic element with the Display Mode "Everywhere", so they can be accessed in the Data Load.

Data Load

If the target is a Datamart, create a calculation data load for Datamart that runs incrementally and assign the appropriate PA Analytics and PB generic logics as the Formula and Feeder logics respectively. If the target is a Data Source, update the existing 'Flush' type Data Load for the Data Source by configuring the Formula and Feeder logics in the Calculation section.