Forum Discussion
QuickBaseCoachD
7 years agoQrew Captain
Sure, I game for a brain teaser. Especially when we get to use new functions in new ways.
I test ed this..
Make a field called [Email Body w/ | separators]
var text RawEmail = [email body];
var text A = SearchAndReplace($RawEmail,"STUDY NUMBER","|");
var text B = SearchAndReplace($A,"SITE LOCATION","|");
var text C = SearchAndReplace($B,"PROTOCOL","|");
var text D = SearchAndReplace($C,"MEDIA NAME","|");
var text E = SearchAndReplace($D,"NAME","|");
var text F = SearchAndReplace($E,"MEDIA TYPE","|");
var text G = SearchAndReplace($F,"MOBILE PHONE","|");
$G
That should replace all the field labels with a pipe | character. That is a character unlikely to be found in the real data.
Then the formula for the Study will be
Trim(Part([Email Body w/ | separators],2,"|"))
The formula for Site Location will be
Trim(Part([Email Body w/ | separators],3,"|"))
.. etc....
I test ed this..
Make a field called [Email Body w/ | separators]
var text RawEmail = [email body];
var text A = SearchAndReplace($RawEmail,"STUDY NUMBER","|");
var text B = SearchAndReplace($A,"SITE LOCATION","|");
var text C = SearchAndReplace($B,"PROTOCOL","|");
var text D = SearchAndReplace($C,"MEDIA NAME","|");
var text E = SearchAndReplace($D,"NAME","|");
var text F = SearchAndReplace($E,"MEDIA TYPE","|");
var text G = SearchAndReplace($F,"MOBILE PHONE","|");
$G
That should replace all the field labels with a pipe | character. That is a character unlikely to be found in the real data.
Then the formula for the Study will be
Trim(Part([Email Body w/ | separators],2,"|"))
The formula for Site Location will be
Trim(Part([Email Body w/ | separators],3,"|"))
.. etc....
- AlexCertificati7 years agoQrew CadetThis is so good!
- PeterRifken7 years agoQuickbase Staffnice solve!
- QuincyAdam7 years agoQrew CadetI adjusted your code to the following format:
var text RawEmail = [Body];var text A = SearchAndReplace($RawEmail,"STUDY NUMBER","|");
var text B = SearchAndReplace($A,"SITE LOCATION","|");
var text C = SearchAndReplace($B,"PROTOCOL","|");
var text D = SearchAndReplace($C,"NAME","|");
var text E = SearchAndReplace($D,"EMAIL","|");
var text F = SearchAndReplace($E,"MEDIA TYPE","|");
var text G = SearchAndReplace($F,"MEDIA NAME","|");
var text H = SearchAndReplace($G,"MOBILE PHONE","|");
$H
And I'm using the following formula for Media Type:
Trim(Part([Email Body w/ | separators],7,"|"))
However, it's displaying the Media Type and the word "MEDIA" from the next line, "MEDIA NAME"
Is there anyway of preventing that? - QuickBaseCoachD7 years agoQrew CaptainYes, it has to do with the sequence. The word MEDIA NAME has the word NAME in it. So we need to process MEDIA NAME first
I suggest that you use my original code. Did you test my original code? - QuincyAdam7 years agoQrew CadetI had var text D = SearchAndReplace($C,"NAME","|"); in there twice! Thanks!