Formula to enforce sentence formatting

Post Author: Janis
CA Forum: Formula
I have searched the forums and have not found an answer to this...
I have a text field on my report which is basically used for lengthy notes ( ten sentences or so) on a particular contact/customer. My users are able to type text anyway the see fit.  For example, the sentence "He is very satisfied with our services." can be written as "HE IS VERY SATISFIED WITH OUR SERVICES." or "he is very satisfied with our services." or "hE Is VERY saTIsFiED with oUr SERviceS.", or in any combination of uppercase and lowercase letters.
This looks horrible on the report.  What I need to know is if there is a way to force all of the text into some type of true sentence structure, meaning that only the first word of each sentence is capitalized?  So, in my example, even when users enter text like stated above, the report will display He is very satisfied with our services.
Using the uppercase or lowercase functions do not give the desired results.  I am currently using the propercase function, but this does not give the desired results since the first letter of each word is capitalized.
Any help would be much appreciated!
Janis

Post Author: SKodidine
CA Forum: Formula
Perhaps not the most efficient but that is all I can think of right now other than creating/modifying a custom function to capitalize the first word of the sentence.
Assumptions:    Every sentence is terminated with a period. 
                        After every period there is a space or two.
Here is the formula:
STRINGVAR X := LCASE({YOURTEXT.FIELD});         // convert the entire string to lowercase
X := REPLACE(X,'. ','.');                                                      // repeated twice to handle either one space
X := REPLACE(X,'. ','.');                                                      // after the period or two
STRINGVAR TEMP;
STRINGVAR FINAL;
NUMBERVAR Z;
NUMBERVAR STRLEN :=    LENGTH (X);
NUMBERVAR I;
FOR I := 1 TO STRLEN DO                                                // get the count of number of sentences by counting
(                                                                                // the number of periods
            IF X[I] = '.' THEN Z := Z + 1;
IF Z = 0 THEN Z := 1;
FOR I := 1 TO Z DO                                                 // process each sentence
            TEMP := SPLIT(X,'.')[I];                                         
            FINAL := FINAL & UCASE(TEMP[1]) & TEMP[2 TO LEN(TEMP)] & '. ';
FINAL;

Similar Messages

  • Acrobat 9.3.4 doesn't enforce Date Formating

    After we upgraded to Acrobat 9.3.4 from a previous version of 9.3 acrobat doesn't enforce date formating..before in a Text field formated as Date mm/dd/yyyy it would autocompelete if we typed in 9/21 to 9/21/2010.. now it doesn't, we can type any random text in the field and it isn't validated.
    Ideas?

    Just checked, its enabled.. when I say validate I'm referring to Acrobat's internal date format validation, not JavaScript.
    For example if you create a text box, goto properties, format tab, format category = date, date options mm/dd/yyyy
    now if you type:
    "abcdef" in that text box it should say, "Invalid Date/time: please ensure that the date/time exists.
    if you type 9/21 it will automatically turn it into 9/21/2010.
    After Appling the 9.3.4 update no such validation takes place, any value entered is accepted..

  • Straw poll: use of triggers to enforce data format rules.

    For a while now I have used before insert triggers to enforce data formatting rules, such as applying UPPER to certain fields. This is a habit I picked up in the mists of time, and never really thought about before...
    ...until just now, when a colleague questioned the wisdom of this practice, in language too colourful for a family forum like this. So the question is: is this good practice or not?
    In the particularly case in point, I could have used (and may yet implement) a foreign key to a reference code table, which would enforce uppercaseness as a side effect. Alternatively I could have used a CHECK CONSTRAINT, but the potential values are too fluid for that.
    I am interested in your opinion on the general principle: is it right for the database to enforce formatting without the user being aware of the change?
    Thanks in advance.
    Cheers, APC

    Andrew:
    In principle, I would not disagree with enforcing formatting in the database, as long as that formatting is required to satisfy a business requirement (e.g. one of our departments has a business rule that all medications must be stored in upper case, dosage information and frequency must be all lower case).
    In your case in point, I would absolutely enforce upper case in the database if you are going to enforce a foreign key. If the code value is stored upper case in the code table, then a trigger to UPPER(code) in the child table is appropriate since an end-user would likely be confused by a constraint violation between 'ABC' and 'abc'. Even if you are not going to enforce the FK, I would assume that you will join to the parent with some frequency, so having both in the same format makes the joins a lot easier.
    My argument against a check constraint to enforce upper case would be based on the (hypothetical, but realistic) user thought process of:
    "Damm application keeps making me re-type everything, so I'm just going to put the caps lock key on AND SHOUT AT THE DATABASE".
    Having said that, if you are just enforcing upper case to get case insensitive searches, then function based indexes get around that problem without forcing formatting.
    My $0.02 CDN (about a ha'penny)
    John
    P.S. You may want to get a better class of colleague.

  • Formula columns  delay the formatting

    I have my pay roll report developed in matrix format.It was working fine,but with the addition of two formula columns(which in turn call two functions defined at the database level,to derive some additional values)the formatting gets extremely delayed.I cannot perform these calculations in the query itself as it involve some computing based on certain conditions.So how can I make the report run faster?Does having many formula columns decrease the efficiency of report being run?
    Thanks
    Jay

    Try to perform the query in your report. Include performance hints like /*+ first_rows */ or.. other, Build indexes,
    Hope this help,
    MCB

  • Numbers for IOS -- How to paste formulas and/or change formatting

    I'm a brand new user of Numbers for IOS (version 5.0.1) on my iPhone...  It was suggested in the iWork > Numbers forum that I check in one of the IOS forums for help with this version of Numbers, and the iPhone forum has a comment to the effect that there are more IOS Numbers users in the iPad forum....  So here's my question:
    I received an email with a cute countdown formula for the new year, =10*9*8+7+6-5+4*321 so I copied it from my email, and pasted it into a cell in Numbers for IOS.  I found that it won't paste at all (the black "Paste" symbol doesn't appear) unless I hit the "T" for text mode, so that's what I did, and I pasted it into the cell of a table.  But it shows up simply as =10*9*8+7+6-5+4*321, not the value of that expression, which is supposed to be 2012.  So I double-clicked a different cell, and selected the = symbol, and then tried to paste the formula into the green bar at the top, but like I said, the only thing that pops up in that mode is the magnifying glass.  So I typed the formula in, using the x in place of the asterisks, and it worked just fine.  So I can use formulas, and I can paste text into cells, but I just can't paste text into cells and have Numbers interpret the text as a formula.  Any hints?  Thanks!

    This isn't a pro answer but I found if you use the + cursor and select all cells and the set font, color or whatever you want, when you then go to specific cells, it will be the way you want.

  • Is there any way to use a formula or reference in conditional formatting

    I would like to use conditional formatting (or something similar) to change either the background color, or text color, of a cell. The conditional formatting in the inspector will allow you to do this using numbers or text as the condition.
    Is there any way to do the same thing using either a formula or cell reference? I have created a budget with two sheets, "Budget" and "Actual". Each sheet has two tables, "Income" and Expenses." In the "Actual :: Expenses" table I would like to be able to change the cell color depending on the difference between the Actual and the Budget corresponding cells.
    I know I can do this by making a new column "Difference" write the formula and enter conditional formatting for that particular cell, but I DON'T WANT TO!!
    Just for fun, is there any way to roll over a cell and have a info box "pop up" that could show me what the difference between the two corresponding cells is. Kind of similar to how when you roll the mouse pointer over a file the box expands to show you the entire name of the file. Not to optimistic about this one.
    Thanks

    PeterVogelpohl wrote:
    Is there any way to do the same thing using either a formula or cell reference?
    Yes, Peter. Purchase iWork 09. Numbers 09 offers conditional format vs. content of another cell.
    Jerry

  • Challenge to get a date correctly formatted...

    Hi All,
    Does anyone know how to get a formatted date cell to be copied into a formula without losing its formatting ?
    for instance cell a1 contains the formatted date: 02 September 2008
    I want to use cell a1 into the following formula in cell a2:
    ="The bill must be payed before "&a1+14&" on account number 1.1.1.1"
    So the result should be:
    The bill must be payed before 16 September 2008 on account number 1.1.1.1
    But what happens is:
    The bill must be payed before sept 16, 2008 on account number 1.1.1.1
    I've already tried to reapply the formatting by using the inspector, but that didn't solve it..
    Can anyone solve this strange behavior ?

    SergeRyz wrote:
    1) What happens if today is for instance 25th of September, then the day would become 39. So you have to create a very complex formula to take into account the amount of days in the specific month.
    On my system at least, Numbers automatically handles this, although if you use an auxiliary cell like in my example, that cell will have a little blue triangle which when clicked will tell you a number was expected between 1 & 31. However, this does not affect the result, nor does the triangle appear in the cell with the formatted result in a sentence.
    2) This code will be present on an invoice, so it can't be visible as i have to print it afterwards and sent it to a customer.
    I'm not quite sure I understand what you mean. The cell formula should appear only if you set the cell containing it to the text format. And if you want printed output free of any auxiliary cells, either put them in a row or column & choose the "Hide" option for that, or put the cells in another table (possibly on another sheet) & don't print that.
    Basically, the idea is to use an auxiliary cell for the future date, concatenate that with whatever text strings you want with the "&" operator in another cell, & set the format of the auxiliary cell to the one you desire. The date format of the cell with the concatenation should track the date format of the auxiliary cell, as long as you don't set its format to text.

  • Getting Runtiime error while exporting to Excel 97-2000 format (URGENT)

    Post Author: net_us2001
    CA Forum: Exporting
    Hello Everyone,
    This is my first time in this forum.
    I am getting runtime error while exporting the report in EXCEL 97-2000, but exporting perfactly in MS-EXCEL (Data only) format.
    I found the reason is, using expression (formula) for formatting phone number as shown below.
    On table field "abPhone",
       used  "formula = PhoneFormat() " expression on format field -> common tab -> display string .
    Intead that i have used fumula e.g. test1 and used same expression, then it was exporting perfactly..
    Having above problem if i use expression to supress group header and report header. 
    So let me know if anyone can help, why it was giving error in first case.
    Thanks in advance
    Thanks,
    Nitin

    Hi,
    This is the Technical limitation of ABAP list export to local file.
    ALV grid greater than 1023 characters per line will be split into 2 lines.
    To prevent a line break occuring when you download the list as a local spreadsheet file, you must reduce the width of the list in ALV. You can do this either by hiding columns or by changing the column widths in the ALV. Take care that the column heading characters also dont exceed 1023 characters. This will work.
    Thanks
    LG

  • Serious bug in LabView 8.5 Formula Node

    Hello,
    Thought I would warn my fellow LabView programmers about a serious error in the Formula Node:
    The problem may be encountered by anyone running a non-us LabView installation:
    I am located in Norway, and over here we use the comma (,) as the separator in floating point numbers: So, the use 3.14 is written like 3,14.
    The problem is that the Formula Node accepts both formats, but only the US Notation is interpreted correctly !
    Example:
    float64 x1, x2;
    x1 = 3.14;    // Interpreted Correctly !
    x2 = 3,14;     // Interpreted as 3: One might say this leads to problems.......
    Message Edited by geirove on 06-13-2008 06:23 AM
    Geir Ove

    geirove wrote:
    JoeLabView wrote:
    Hi Geir,
    It is not a bug.  ............
     The node does not recognize localized decimal separators."
    Of course it is a Bug:  **Any** code that **any** compiler does not recognize, should be flagged with an error message ! I have written my share of compilers myself, and they all flag down code that is not accepted as an error.
    Failing to do so may cause serious, expensive and very hard to trace errors.
    Sorry, but I would expect that the NI team in their 20. year of LabView development is capable of better than this.
    Sorry to disappoint you! It's not a bug since that statement is absolutely valid albeit useless in that context.
    The Formula Node since LabVIEW 7 supports C syntax except some advanced features such as pointers. In C the comma in expressions is the sequence operator meaning it separates expressions that will be executed from left to right and the last one will actually be the result of the entire sequence expression. This is often used for the initilizer expression inside the for statement, to initilize several variables to a start value.
    And the NI team really is a lot better than you think. The online help may be a bit short about the reasons why the comma is not supported as decimal point but there have been many people thinking about this before it was made like that. It was either C syntax support without localized decimal point or some homegrown syntax with localized decimal point and they went for the first.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Cell format

    Hi
    The two cells AG13 and AG14 contain the same formula, but a different format
    I copy AG13 and paste it to AG 14 and nothing happens.  I copy AG14 to AG13 and nothing happens.
    The ofmat of row 13 is Automatic.  The format of ro14 is numeric.  I cannot change any of the formats.
    I would like the result to be an empty string when there are no values to average as in AG13.
    What am I doing wrong?
    Thanks.

    Hi
    All the rows contain 0.0 as they collect data from a single column in another sheet.  The font colour is conditionally set to white when the value is 0,since Numbers does not have the show/hide zero values setting.  But that is beside the point.
    I've just realised that the formula should have ">" instead of "=". My bad! But that only swaps things around.
    So, what I would like to do is to have either an empty string or a number displayed according to an IF statement, but never display a '0'.
    The formula should be IF(B13>0,AVERAGEA(B13:AF13),"").
    I have to include the B13>0 test because AVERAGEA will not work if all values are 0.
    Why is AG13 giving a 0 and AG14 giving an empty string?

  • Formula field won't display

    Post Author: Richard bates
    CA Forum: General
    Sorry for the overly-generic subject, but I'm not exactly sure how to classify this problem.  I'm convinced it's a Crystal Reports bug but would be delighted to be convinced otherwise.  Here's the issue:
    Whenever I create a formula field in the format of trim(field A) " "trim(fieldB) and use the field in a report, if field B is null the data for the entire field will be skipped in the report.  Doesn't matter if the formula is in a group header or the detail line, the result is the same.  I've created a formula with the obvious conditionals, ie, if field B is null then trim(field A) else trim(fieldA)" " trim(fieldB) but that doesn't work either.  I am trying to combine two address lines.  In most cases there is not a second address field, so most addresses don't display using this method.  Someone on another board suggested a workaround which I am using (placing the second address line in it's own group and then suppressing the group when empty) but I have another instance where this won't work, ie, in the detail line.  I'm trying to actually combined three fields (first name, last name, and title).  In this case it is title which is usually blank.
    Am I missing something head-slapping obvious here?
    Thanks in advance
    Richard Bates

    Post Author: foghat
    CA Forum: General
    Seems to me I've come across the same thing way back.  It is a crystal thing, bug or just the odd way crystal does some stuff, I'm not sure (is there a difference?)  I can't remember what my fix was, think I may have had some logic similar to what you tried, but I had more than 2 address fields to compare, it sucked. You could try this (basic syntax):dim str0 as stringdim str1 as stringstr0 = trim{field A}str1 = iif (isnull ( {field B} ), "", trim {field B})formula = str0 & " " & str1 Add the iff logic to str0 as well if field A can be null. Things like this are why, when possible, I like to build as much logic as possible into a database view and then just use crystal for displaying the data.

  • Formatting a currency field

    I have a currency formatted field that completes a calculation.  Is there a way to format a field so that if the answer is $0.00, that it will not show and print?

    The only way I could get it to take the validation is to type the following:  if(+event.value==0)event.value="";
    But when I put that in my field - it still prints $0.00.  Is it because my formula is not addition but multiplying two fields? 
    You mentioned that I may have to change some field values first?  The two fields that my original formula is figuring are formatted for a number and the second field is formatted for currency.  So the total is in a field formatted for numbers - with a $ sign and a space before the number.  I have about 30 lines figured for this, but even when I have no entry in either one of the fields, I still get a $0.00.  I really do not want anything to show up unless there is an entry in that field.

  • Help on conditionally Formatting Field in a Cross Tab

    Hi all,
    I like to conditionally format a number field in a cross tab, ie. on a certain column the number should show 2 decimal places, otherwise no decimal places.  I have tried a formula in the Decimals of the Format Field, If {Command.COL_TITLE}= "G"
    Then
    2
    else
    0.
    Column G is the one that is to display the number in 2 decimal places.  The formula runs, but it never  {Command.COL_TITLE}= "G" is never true, ever.  COL_TITLE is the columns of the Cross Tab.
    Any ideas ?
    Thanks
    Austin

    Austin,
    If you are trying to format a column then try using the GridRowColumn function.
    In the Customize Style tab highlight the column field and check what the alias for formula is. Then format the decimal places for the summarized field with a formula similar to the following;
    If  GridRowColumn("Alias for formula value") = "G" then 2 else 0

  • BC4J Entity/View date attribute format

    JDEV version 9.0.2.829
    I made a simple business component.
    I tried to set the format of a date attribute in the Entity object and also in the View object.
    I double clicked the attribute in structure window, changed Format Type in Control Hints tab to
    "Simple Date" and Format to "dd-MM-yyyy" but running the tester or a JClient application based on that component nothing changes. The format remains "yyyy-MM-dd".
    Does anyone know what is going wrong?
    Minas

    Do you select the format "dd-mm-yyyy" or do you just typ it in into the field format type of the control hints?
    If you just type in the value you have to do some changes so that "dd-mm-yyyy" comes also in the combobox so you can select it!!
    You have to change a thing in the formatinfo.xml document
    In this document you see the next tag:
    <DOMAIN CLASS="oracle.jbo.domain.Date">
    <FORMATTER name="Simple Date" class="oracle.jbo.format.DefaultDateFormatter">
    <FORMAT text="yyyy-MM-dd" />
    <FORMAT text="yyyy-MM-dd G 'at' hh:mm:ss" />
    <FORMAT text="EEE, MMM d, ''yy" />
    </FORMATTER>
    </DOMAIN>
    put in the next sentence
    <FORMAT text="dd-MM-yyyy" />
    and then this new format type comes in the combobox on the control hints. If you now select it, it normally works!
    It works with me after I did the changes into formatinfo.xml so I hope it also works with you!!

  • Comma delimited formatting in Smartview

    I'm creating a report in smartview 9.3.1
    I have few columns with formulas and I have format my report (bold ,comma delimited and some color).
    The issue is when I do a refresh all the formatting remains intact except the comma delimited formatting on columns with formulas.
    I already have the "Use Excel Formatting" checked.
    Does any one run into this issue before ?

    Hi Brian,
    There are a few ways to do this:
    Using Subreports:
    1) Insert a Subreport with its datasource being the same table as the Main Report's in the Report Header.
    2) Inside the Subreport, create a formula with a code that looks similar to the below:
    whileprintingrecords;
    stringvar dates := dates + {Year} + ", ";
    Place the formula on the Details section
    3) Create another formula and place it on the Report Footer:
    whileprintingrecords;
    stringvar dates;
    Left(dates, len(dates)-2);
    4) Suppress all the sections of the Subreport, except the Report Footer
    5) Copy the record selection formula from the Main Report into the Subreport so that it returns the same records as the Subreport
    If the data for 'Authors' and 'Departments' is available for each row just like the 'Year', you can actually use the same subreport and modify the above formula by adding 'shared variables' to bring back a comma delimited string of the 'years', 'authors' and 'departments'
    Using SQL:
    This is probably the most efficient way to do this. Just write a SQL that returns the list of years as a comma separated string along with the other columns > drag and drop the column on the report header
    -Abhilash

Maybe you are looking for