Forum Discussion
Create New Column based on Value found between Quotation Marks
- 2 years ago
quincy_p, here is my suggested solution.
I am using a test data table of one row with one column called [Integration_Result__c] which contains the full text of the error message you posted
Error CS_ServiceRequest_PUB.Create_ServiceRequest API Programming Error (CS_ServiceRequest_UTIL.Validate_Customer_Product): The value "111448692" for field p_customer_product_id is invalid.
I then created a Calculated Column with this DAX expression:
assetID = VAR search1 = "(CS_ServiceRequest_UTIL.Validate_Customer_Product): The value """ VAR search2 = """ for field p_customer_product_id is invalid" VAR pos1 = FIND(search1, YourTable[Integration_Result__c], 1, 0) VAR pos2 = FIND(search2, YourTable[Integration_Result__c], 1, 0) VAR assetID = SWITCH(TRUE(), pos1 > 0 && pos2 > 0, MID( YourTable[Integration_Result__c], pos1 + LEN(search1), pos2 - pos1 - LEN(search1) ) ) RETURN assetIDThis gives me the following output:
Is this what you were looking for?
quincy_p, here is my suggested solution.
I am using a test data table of one row with one column called [Integration_Result__c] which contains the full text of the error message you posted
Error CS_ServiceRequest_PUB.Create_ServiceRequest API Programming Error (CS_ServiceRequest_UTIL.Validate_Customer_Product): The value "111448692" for field p_customer_product_id is invalid.
I then created a Calculated Column with this DAX expression:
assetID =
VAR search1 = "(CS_ServiceRequest_UTIL.Validate_Customer_Product): The value """
VAR search2 = """ for field p_customer_product_id is invalid"
VAR pos1 = FIND(search1, YourTable[Integration_Result__c], 1, 0)
VAR pos2 = FIND(search2, YourTable[Integration_Result__c], 1, 0)
VAR assetID =
SWITCH(TRUE(),
pos1 > 0 && pos2 > 0,
MID(
YourTable[Integration_Result__c],
pos1 + LEN(search1),
pos2 - pos1 - LEN(search1)
)
)
RETURN assetID
This gives me the following output:
Is this what you were looking for?
Yes that's fantastic! Thank you!