Velocity - Duplicate Criteria

Travis_Schwartz
Level 4

Velocity - Duplicate Criteria

I'm working on a project for members who use our HELOC product. the issue I'm having is the information I need to write from is coming from a custom object and not from the lead record.

 

What I need to solve for is the following:

I exported the list for the credit limit:

 ${account_cList}

and previewed using a member who had this CO and that returned the values of:

[{creditLimit=null}, {creditLimit=null}, {creditLimit=null}, {creditLimit=2000}, {creditLimit=20000}]

The problem is I need the creditLimit value that is 20000, but I don't know how to identify which creditLimit value for the token to look at... and to (potentially) add complexity, I need to account for two different products:

{description=HELOC 80%},  {description=HELOC 70%}

and so once I get that, I need to take their limit and subtract the value of the balance to give me the difference, and identify which of the balances are associated with the correct HELOC product above.

 

This is what I tried with no luck (I know it's way off... I just don't know what to do to get it on track):

#foreach( $list in $account_cList )
#if( $list.listID.equals("creditLimit") )
#elseif($list.listID.equals("HELOC 70%, HELOC 80%") )
#set( $targetList = $list )
#break
#end
#end
$math.div($list, "$list.listID.equals(HELOC 70%, HELOC 80%"))
${display.alt($targetList.creditLimit,"No matching list found.")}

 

Thanks.

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity - Duplicate Criteria

Yeah, that code basically makes no sense... but you knew that. 😶

 

Let's go over the logic again. Try not to guess about the code implementation, explain the business requirement in plain (though technical) English.

 

Each entry in your account_cList has 2 properties of interest:

 

  • $creditLimit, a nullable Integer
  • $description, a String that happens to be consistently (I hope) formatted as a space-delimited list of 2 subitems:
    • the first subitem is a product (String); after parsing, let's store that as $product
    • the second subitem is a percentage (numeric String + the "%" sign); after parsing and converting it to a Decimal, that's the $percentage

Correct?

 

You mention a "balance" but do not explain how that is stored.

 

Now explain exactly how the logic works with the list of objects and their properties.

Travis_Schwartz
Level 4

Re: Velocity - Duplicate Criteria

Yes, those are the two areas of interest.

$creditLimit is your favorite, currency... (I know, I'm still working on a plan to transition them. trying to find a solution that doesn't disrupt current campaigns.)

$description is a string. I'm not sure how it is. I don't see that under admin. Any advice on where to check on this? My concern is that they are not subitems, but I don't know for sure.

 

balance is also a currency field.

 

Assuming (I'll confirm) that they are formatted as 2 subitems, I think what we are wanting is for each entry in the account_cList, if $product = heloc and $percentage = 70% or 80%, then we use the math function to divide the value in $creditLimit but the value in the balance field.

We then take that value and display it as currency with $number.currency and adjust the stringlength to insert the comma.

Did I run off the rails again?

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity - Duplicate Criteria

Where is $balance stored? CO property or Lead property?

 


$description is a string. I'm not sure how it is. I don't see that under admin. Any advice on where to check on this? My concern is that they are not subitems, but I don't know for sure.


If it's a String, Marketo will not constrain the contents (there's no such thing as a "String that must contain 2 space-delimited substrings and the second one ends with the '%' sign") so your app is responsible for the contents.

 

You actually didn't describe the requirement clearly yet...

 


then we use the math function to divide the value in $creditLimit but the value in the balance field.

... how do the $percentage, $creditLimit, and $balance relate mathematically?

Also, can you try to use Courier for any inline code references like I do?

Travis_Schwartz
Level 4

Re: Velocity - Duplicate Criteria

Oh, $balance is CO property.

 

I'm not entirely sure I follow. There isn't necessarily a mathematical connection between the three for the purposes of this project.

The percentage would just limit how high $balance could be (based on the percentage of the equity in ones home). I just need the code to tell the system that it doesn't matter which "type" of HELOC (either 70%, or 80%. Those are the only two types we offer), just that when it's looking at either one of them, to take $creditLimit and subtract $balance. This would display the amount our member would have available as $balance reflects on the amount they have pulled. I'm not sure why I said divide earlier... that makes zero sense.

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity - Duplicate Criteria


The percentage would just limit how high $balance could be (based on the percentage of the equity in ones home). 

You didn't say that before.

 


This would display the amount our member would have available as $balance reflects on the amount they have pulled. I'm not sure why I said divide earlier... that makes zero sense.

OK, so let's review:

 

FOREACH $object in $objectList

IF $object.description starts with "HELOC "

THEN add ($object.creditLimit - $object.balance) to collection $outputtableObjectList

 

FOREACH $outputtable in $outputtableObjectList

Output $outputtable in specific Number format

 

 

Travis_Schwartz
Level 4

Re: Velocity - Duplicate Criteria

Sorry, in a bit of a haze today.

 

Would I need to take the code you provided and change the $objectList with my $account_cList and replace the specific number format with $number.currency

 

Thanks for bearing with me.