Jump to content

bullets or points


Melaperu

Recommended Posts

I think I need to make a rule to keep the points between the phone number digits PANTONE 485 C. Is this correct?

 

When I upload it to marcom i will set these phone numbers to text attributes so they will pull from the spreadsheet but where in the rule should i add it?

 

thank you. Screenshot image provided as well.

 

 

//this function will take content of the E-mail field as an input and format it in such a way
//that the @ character and any numerals in the email address will be scaled down.
//the changedChars variable is set to the size of the characters to be scaled down (numerals and @ char.)

//a variable string1 is defined to hold content of the E-mail field.
string1 = Field("E-mail");

//the following 2 variable values need to be changed to the desired character point sizes
changedChars_pointsize = 6;
non_changedChars_pointsize = 7;

//new_string1 will contain the return value
new_string1 = "";

//create reusable strings that have the <z> tags for point size changes 
changedChars_pointsize_tag = "<z newsize=" + changedChars_pointsize + ">";
non_changedChars_pointsize_tag = "<z newsize=" + non_changedChars_pointsize + ">";

//count the characters in the input string
charCount = string1.length;

//set a flag variable to signify if a looked-for character is encountered.  Set to false initially.
found_lfc_flag = 0;

//a loop will be used to look at each character, determine if it is a looked-for character, 
//and decide if a point size tag is required.
for (x=1; x<=charCount; x++)
{
   //get a character from the string and its ASCII code
   single_char = Mid(string1, x, 1);
   ascii_code = Asc(single_char);

   //if the ASCII code is between 47 and 57, the character is a number
   //if the ASCII code is 64, it is the "@" character
   if ((ascii_code >= 47 && ascii_code <= 57) | ascii_code == 64)
   {
       //At this point in the code, we know that the current char is a looked-for character
       //the found_lfc_flag tracks if the previous char was a number
       //or not.
       if (found_lfc_flag == 0)
       {
           //this code will set the flag to signify that a number was found
           //and also add the tagged markup to the string to change the point size.
           found_lfc_flag = 1;
           new_string1 = new_string1 + changedChars_pointsize_tag;
       }
   }
   else
   {
   //The else condition will execute if the current character is not a looked-for character
   //or if this is the first character in the string.
       if (found_lfc_flag == 1 || x==1)
       {
           found_lfc_flag = 0;
           new_string1 = new_string1 + non_changedChars_pointsize_tag;
       }
   }

   //lastly, the character we inspected is added to the string.
   new_string1 = new_string1 + single_char;

}

return new_string1;

ScreenShot2014-04-29at12_16_26PM.png.fbedabb7a9bb3d1b566d77e71f597291.png

Link to comment
Share on other sites

I think I need to make a rule to keep the points between the phone number digits PANTONE 485 C. Is this correct?

I don't know what is considered correct output for your job.

When I upload it to marcom i will set these phone numbers to text attributes so they will pull from the spreadsheet but where in the rule should i add it?

Your rule seems to be dealing with email addresses, but your explanation and your screen shot are about phone numbers. Are you sure you posted the right rule? Also, I'm not sure what you mean by "text attributes."

 

At any rate, if you want the period character to appear in a different style or color, that's not too hard to do. Assuming that you're returning new_string1 as in the rule you posted, you can just change the last line to this:

return new_string1.replace(/\./g, '<color name="PANTONE 485 C">.</color>');

Link to comment
Share on other sites

ok, is there a specific rule already available that i can edit, i only chose this one because i thought it would work for phone numbers, but you are saying this is only for emails?

 

text attributes is the functionality for these community nametags, when a property manager logs in to order these tags for their community it will already pull from my data sheet for that specific user.

Link to comment
Share on other sites

ok, is there a specific rule already available that i can edit, i only chose this one because i thought it would work for phone numbers, but you are saying this is only for emails?

You can start with anything and edit it, but the comment at the very top of the rule you posted says, "this function will take content of the E-mail field as an input and format it..."

text attributes is the functionality for these community nametags, when a property manager logs in to order these tags for their community it will already pull from my data sheet for that specific user.

Sorry, I'm not familiar with that MarcomCentral functionality. You might want to ask about that on the MarcomCentral forum.

 

At any rate, I think my first reply will do what you want for your phone numbers.

Link to comment
Share on other sites

thank you for the code Dan, however I see only point size,

var base_pointsize = 7; var num_pointsize = 6; return '<span pointsize="' + base_pointsize + '">' + Field("E-mail").replace(/[\d@]+/g, '<span pointsize="' + num_pointsize + '">$&</span>') + '</span>';

would i add var base_pointcolor? You gave me size which is great but I need it for color. Could i replace the previous return with the one below,

 

return new_string1.replace(/\./g, '<color name="PANTONE 485 C">.</color>');

what would my return be then? Sorry for the confusion i hope im asking the right question. The screenshot i sent previously, need to maintain the red color dots/periods between the phone number.

 

thank you.

Link to comment
Share on other sites

thank you for the code Dan, however I see only point size,

var base_pointsize = 7; var num_pointsize = 6; return '<span pointsize="' + base_pointsize + '">' + Field("E-mail").replace(/[\d@]+/g, '<span pointsize="' + num_pointsize + '">$&</span>') + '</span>';

would i add var base_pointcolor? You gave me size which is great but I need it for color.

That code was meant as a replacement for the original function you posted, which changes the point size of certain characters in an email address. Neither that original function you posted, nor what I posted to replace it, have anything at all to do with changing the color of dots/periods in a phone number.

Could i replace the previous return with the one below,

 

return new_string1.replace(/\./g, '<color name="PANTONE 485 C">.</color>');

what would my return be then?

If you already have a field containing a phone number, then you only need a one-line rule, like so:

return Field("Phone Number").replace(/\./g, '<color name="PANTONE 485 C">.</color>');

 

Sorry for the confusion i hope im asking the right question. The screenshot i sent previously, need to maintain the red color dots/periods between the phone number.

Yes, that one-liner should do that. Sorry for furthering the confusion by posting about the email rule.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...