You need to sign in to do that
Don't have an account?
Donny S
Formula to get quantity with mixed text and numbers
Hello,
We have thousands of skus that pass over to salesforce. I use shiprush for shipping. I am trying to solve a problem of more than 1 sku in my field. For example: 12:GARBOO is a common sku, 12 is the quantity and Garboo is the product sku. Right now I have a formula that will popuilate the ItemQuantity3 custom field with 12 (or any number to the left of the text). This is what I am using and it works great for single sku's.
IF (
ISNUMBER( LEFT( Sku_Shipped_1__c, 2 ) ),
VALUE( LEFT( Sku_Shipped_1__c, 2 ) ),
VALUE( LEFT( Sku_Shipped_1__c, 1 ) )
)
The problem is if a customer orders more than one product it passes through "12:GARBOO, 1:GRTEA, 4:GARCUL". My formula will only take the left nubmer and populate ItemQuantity3. I need the quantity to populate with "17" or what ever numbers are in there. It could be "1:GARBOO, 3:GRENC, 2:RKTVTL" What formula could I use to add only numbers in a field so the latter would pull "6"
Completely stumped.
Thank you in advance :)
We have thousands of skus that pass over to salesforce. I use shiprush for shipping. I am trying to solve a problem of more than 1 sku in my field. For example: 12:GARBOO is a common sku, 12 is the quantity and Garboo is the product sku. Right now I have a formula that will popuilate the ItemQuantity3 custom field with 12 (or any number to the left of the text). This is what I am using and it works great for single sku's.
IF (
ISNUMBER( LEFT( Sku_Shipped_1__c, 2 ) ),
VALUE( LEFT( Sku_Shipped_1__c, 2 ) ),
VALUE( LEFT( Sku_Shipped_1__c, 1 ) )
)
The problem is if a customer orders more than one product it passes through "12:GARBOO, 1:GRTEA, 4:GARCUL". My formula will only take the left nubmer and populate ItemQuantity3. I need the quantity to populate with "17" or what ever numbers are in there. It could be "1:GARBOO, 3:GRENC, 2:RKTVTL" What formula could I use to add only numbers in a field so the latter would pull "6"
Completely stumped.
Thank you in advance :)
However, this can be acheived using a before insert trigger.
Regards,
Satish Kumar
Satish is right, you will need to write a trigger that runs on "before insert" (and maybe "before update"). The code in the following post will need modification to work in your trigger but it conveys the basic idea. Let me know if you have any questions.
Glyn Anderson
Sr Developer | System Analyst | ClosedWon | closedwon.com
Certified Developer | Certified Advanced Administrator
Twitter: @GlynAtClosedWon
List<String> list_SKUs = theRecord.Sku_Shipped_1__c.split( ',\\s+' );
Integer numUnits = 0;
for ( String sku : list_SKUs )
{
String numString = sku.substringBefore( ':' );
if ( !numString.isNumeric() ) continue;
numUnits += Integer.valueOf( numString );
}
theRecord.ItemQuantity3__c = numUnits;
</pre>