Convert a number field to a string fields for sorting

Good Day All,
I have a field called TranNo which is a number. Then numbers are random (1,3,6,8,99)
In my sort I want to Sort Ascending, but I want the 3 to be at the bottom of the sort..
1 first followed by the 6 then 8 then 99 then 3s.
I wrote a forumla but Crystal doesn't like it.
if {vrcGGP_ContDiary.TranNo} = 1 then Cstr({vrcGGP_ContDiary.TranNo}) = 'A'
else if {vrcGGP_ContDiary.TranNo} = 3 then Cstr({vrcGGP_ContDiary.TranNo}) = 'Z'
else if {vrcGGP_ContDiary.TranNo} = 6 then Cstr({vrcGGP_ContDiary.TranNo}) = 'B'
else if {vrcGGP_ContDiary.TranNo} = 8 then Cstr({vrcGGP_ContDiary.TranNo}) = 'C'
else if {vrcGGP_ContDiary.TranNo} = 99 then Cstr({vrcGGP_ContDiary.TranNo}) = 'D'
else Cstr({vrcGGP_ContDiary.TranNo}) = 'E'
Error ****
The Formula result must be a string
Kind Regards,
Dmarz96

Hi,
Try to create a formula like below and place this on your report and sort based on this formula field.
if {vrcGGP_ContDiary.TranNo} = 1 then  'A'
else if {vrcGGP_ContDiary.TranNo} = 3 then  'Z'
else if {vrcGGP_ContDiary.TranNo} = 6 then 'B'
else if {vrcGGP_ContDiary.TranNo} = 8 then 'C'
else if {vrcGGP_ContDiary.TranNo} = 99 then 'D'
else  'E'
Thanks,
Sastry

Similar Messages

  • Need Help on How to Convert a Number Field to an Hour/Minute

    Post Author: syracuse2
    CA Forum: Crystal Reports
    I have a field that shows a duration, i.e. 125.  I would like to convert the number of 125 to 2hr and 5 min.  Any suggestions on how to do this?

    Post Author: GraemeG
    CA Forum: Crystal Reports
    Create a formula and paste the following into it (sorry I use Basic Syntax):
    'Ive laboured a point here a bit so you can get an idea of what you can do.
    'Heres 3 variables - one with your duration and two others for hours and minutesshared xDuration as numbershared xHours as numbershared xMins as number
    'Put some data into the duration and calculate the hours and minutesxDuration = 125xHours =  truncate(xDuration/60)xMins = remainder(xDuration,60)
    'You can then use the variables to get a string with unformatted hours and mins'formula = xHours + "hours " + xMins + "Mins"
    'or you format the hours and minutes nicely'formula = CStr(xHours,0) + "hours " + CStr(xMins,0) + "Mins"
    'or you can make it all into one formula without the need for xHours and xMins variablesformula = CStr((truncate(xDuration/60)),0) + "hours " + CStr(remainder(xDuration,60),0) + "Mins"

  • Using number field for date

    Hi,
    I have a number field that contain a date (YYYYMMDD). In my report I must show the date in the format DDMMYYY.
    Please, help me.
    TIA, Alex
    null

    Hi,
    You can also change your query...
    Instead of the column you are using, use
    to_char(
    to_date(
    ltrim(
    to_char(<date_field>)
    , 'YYYYMMDD'
    , 'DDMMYYYY'
    Hope this helps

  • How can I convert a number field in a to Date?

    I have two columns in a table, and i would like to concate this two fiels to read Januaray-2010
    CREATE TABLE "CATDB"."SC_DTL_MEASURE_DETAIL"
               "TIME_YEAR"                 NUMBER(*,0),
               "TIME_INCREMENT"            NUMBER(*,0),
       )Time_Incriment data need to be changed to month MON Januaray to December
    1
    2
    3
    etc
    12
    Time_year data is
    2010
    2010
    etc

    Well one way easiy way without changing your column datatypes (this would be the best way) is to first convert the numbers into text. Then concat this text. Then convert the text into a date value. Then print the date value as you want it to appear.
    example
    with testdata as (select 2010 TIME_YEAR, 1 TIME_INCREMENT from dual union all
                      select 2010 TIME_YEAR, 12 TIME_INCREMENT from dual)
    select time_year, time_increment,
           to_char(to_date('01-'||to_char(TIME_INCREMENT,'FM00')||'-'||to_char(TIME_YEAR,'FM0000'),'DD-MM-YYYY') ,'FMMonth-YYYY')
    from testdata;
    2010     1     January-2010
    2010     12     December-2010

  • Automatically generate sequential record number field for Z table

    Hi Experts,
    I have a Z table that I would like to add a "record_number" field to, because we are having an issue with duplicate entries not being created in the table.  Is there a way to add that field to the z table and have the system automatically assign a value when the insert statement is made?
    Thanks
    Shane

    Hi Shane,
    You can use the transaction SNUM to create a number range for your custom table. You can assign your invervals to whatever limit you would like. Once you create this range you can then call the function module below to get the next number before the insert (lv_object is the name of your number range and lv_number will export the next sequential number)
      CALL FUNCTION 'NUMBER_GET_NEXT'
        EXPORTING
          nr_range_nr                      = '01'
          object                                = lv_object
        IMPORTING
          number                              = lv_number
        EXCEPTIONS
          interval_not_found            = 1
          number_range_not_intern = 2
          object_not_found              = 3
          quantity_is_0                     = 4
          quantity_is_not_1              = 5
          interval_overflow              = 6
          buffer_overflow                = 7
          OTHERS                             = 8.
      IF sy-subrc <> 0.
      ENDIF.
    Six

  • Do InDesign table fields convert to form fields for interactive PDFs?

    Does InDesign CC recognize table fields as form fields when creating fillable form PDFs - or do I have to create individual text fields on top of the InDesign table and assign form field text field characteristic in the buttons and forms menu?

    I don't believe InDesign itself will apply any form of automated recognition to table cells...BUT...Acrobat's form field recognition certainly picks up empty table cells and assigns them as text-input fields.
    See this page: http://www.eformsfactory.com/mobile-desktop-forms-with-form-field-recognition-in-adobe-acr obat/

  • Number fields filter in ADF

    Hi,
    I am using JDeveloper 11.1.1.4 and ADF-BC in my project.
    I have an query on how adf filter works for wild card characters '*' and '_' number fields and string fields.[Typically 'Number' and 'Varchar2' fields in DB].
    For Number fields, for example if my table has data 9.99 say for column price, when I give filter criteria as 9 , the query gets executed as select * from table where pricing = v_bind_1 [ v_bind_1 = 9]
    and does not fetch any data as per query.When I give filter criteria as 9*,then the query gets executed as select * from table where pricing LIKE v_bind_1 [v_bind_1 = 9%].
    But for string fields when I give filter criteria as N say for example EmpName column, then the query gets executed as select * from emp where EmpName LIKE v_bind_1 [v_bind_1 = N%].
    It behaves differently for string and number fields.
    Is this the standard behavior in ADF ??
    Also please point me to some docs which gives an insight on how filter is performed for different field types.
    Regards,
    Praveen

    Just a thought, for numbers filtering with operators like =,>,< makes more sense rather than using wildcards * or %. This might be the reason why the filtering differs for strings and numbers.

  • ChaRM External Reference Number Field

    Hi
    In ChaRM, we have used external reference number field for information. When a ChaRM CR is created, the requester fills required information in the field. In Normal Correction, this information is not automatically taken from the CR document to the correction document. When we search a normal correction by external reference number, it does not give any result, as the information is only shown in the CR document. This however works as expected in Ur.gent Corrections.
    What could we do about this?
    Many thanks for your answers in advance.
    BR Li

    Hello,
      you need to check the mapping rules for field External Reference Number in copy control for Normal Corrections.
    Go to the IMG: Scenario specific->change request management->Extended config->change trans types->copy control
    Define Mapping rules.
    Regards,
    Raquel

  • Creating a Simple Number Field

    I want to basically create a JTextField only instead of text, numbers including decimals. I tried putting number into a text field but java won't see them as double. I tried the tutorial example with a formatted text field, however, they explain abstract and listeners for validating which I could care less about. I also tried the following code from the tutorial which doesn't work.
    JFormattedTextField ftf = new JFormattedTextField();
    ftf.setValue(new Number(100));
    The compiler says Number cannot be instantiated as it is abstract. How can the tutorial do it? I have had the same problem with other examples in the tutorial such as the Border examples for creating compound borders. The examples don't work because the compiler says Border is not instantiable. It is frustrating. Any help with a simple number field for setting and getting the int or double values as numbers. Thanks.

    Read this section from the Swing tutorial. It does exactly what you want and provides code as well:
    http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html

  • Telephone Number field when adding a new User - CCM 4.2.1

    Is their a way to automatically populate the telephone number field for a user? BAT does not allow this field to be added to the spreadsheet (phones-users). Thanks.

    BAT Version: 5.2.1
    The DN is for the actual line number of the IP phone, not the telephone number field which is stored with the User infromation. These can be independent; for example, I might make a user's actual DN 40001, but want the telephone number in the CallManager Corp Directory to be 5179840001. So, I can place the E.164 number in the Telephone Number field under the User page in CCM. Then, when a user looks up the number using the Directories button on the IP phone, the full E.164 number shows up for that particular user search instead of the 5-digit number which is helpful for offnet dialing and overlapping dial plans among remote sites.
    So, I am looking for a way to automactically populate the Telephone Number field for each user (not the line number of an actual IP phone).
    Thanks.

  • Commas in a number field

    I have developed a web site for a real estate agency for which I have built a custom web app. The web app has a number fields that display information about individual properties in both list and detail formats. Some of the fields I created in the web app are "number" fields. I used number fields for price and square feet because I also have a search form linked to the web app. I needed to have a min and max search capability for these two fields, which the "number" field provides automatically. However, being a "number" field, it does not allow for the use of commas in the field, which is a client requirement. If a comma is used in the web app field, the display is null. For example, the client needs the price to be displayed like this (1,300,000) vs (1300000). Here is a link to the test site: Anne Rogers Realty Group, Inc - Featured Listings.  Note the price and square feet fields on both the list an detail views for the properties. Is there any way around this problem? Thanks in advance

    Well you can do anything from developer's perspective but asking client to put same value twice can make you look unprofessional.
    Here's what I did for many house listing websites.
    1. Client puts price in pure number format ( e.g. 500000 )
    2. wrap the price value with a tag in List/Detail template e.g.   <span class="house-price">{tag_price}</span>
    3. then at the end of the page put a jQuery snippet which would globally format the prices ( e.g. $('.house-price').formatCurrency(); )
       Here's one I use
      https://code.google.com/p/jquery-formatcurrency/
       even if you're not familiar with jQuery it's pretty easy to follow
    No more complain from client

  • String Field rendering as Number Field in CR Basic for VS2008

    I recently migrated from CR for VS2005 to CR Basic for VS2008 and am creating my first report using CR 2008. The SQL result set returns rows containing strings (nvarchar), integers and decimal (7,2) fields.
    The report is getting all rows in the result set, but the string fields as defined in the SQL are 1) rendering in the report as numbers, and 2) showing as empty. The non-string fields render fine. I tried reformatting the report field to string, but only the Number tab appears in the formatting dialog. I also tried converting the SQL field result into an unbound string field, as well as tried the ToText function, but the results were the same. I suspect the field appears empty because of the formatting issue.
    How can I get CR Basic for VS2008 to render a string (nvarchar) field as a string?

    Try placing the field inside a formula field or inside a text field.  That should cause the field to be shown no matter what type of data it is.  If the data is still not showing, then perhaps it is not being returned properly. 
    Things to check:
    -Are you connecting directly to the tables - or are you connecting to a stored procedure?  If you are connecting to a stored procedure and you are using Temp Tables, then make sure you add the line "SETNOCOUNT ON" to your stored proc.
    -Run SQL profiler - see what query is being made, then try running that exact same query through the SQL admin console (Or some other utility that lets you run SQL queries)
    Thanks
    Shawn

  • Number field type mapped as String

    Oracle Number field is mapped as CSTRING when using CRECORDSET class in VC++.
    Any ideas why? or what I should do?

    How big is the number column defined? ANything larger than a NUMBER(14) will map to a character string since there isn't a datatype large enough to hold say a NUMBER(30).
    Here is the mapping as I rememeber it (it is old information and may not be quite up to date with the latest drivers):
    if Scale = 0 then if Precision <= 4 then
    Number Size: Integer
    if Precision <= 9 then Number Size: Long
    Integer
    if Precision <= 15 then Number Size: Double
    if Scale > 0 then if Precision <= 15 then
    Number Size: Double
    Any other field types mapped to Text (Field
    Size = 255).

  • How to convert number field into time

    Hi
    I have made a form for storing of private dialed calls from different extensions. To store call duration i have assigned a number field which is storing following type of data
    1.34
    1.19
    37.29
    1.47
    In above mentioned data decimals are seconds and left side is minutes.
    Now the requirement is that if second is > 30 then 1 minute should be added in minutes else 30 seconds should appear instead of original seconds.
    Please Help!

    >
    To store call duration i have assigned a number field which is storing following type of data
    In above mentioned data decimals are seconds and left side is minutes.
    >
    Please provide info about the form in which you RECEIVE the data. Do you receive the data in MM.SS format like you say you are storing it?
    If not, why are you storing it this way?
    Unless you have some reason to STORE the data differently just store it the way you got it. That way you won't lose any precision and you can manipulate it any way you need to for display purposes.
    If you receive START_TIME and END_TIME then store both of those. Don't calculate and store duration; you will lose END_TIME and if you later need to calculate duration to a different precision you won't be able to.
    Where is the data being stored? Oracle?
    Write a simple function to convert a duration to minutes and seconds using the '>30' rule you have. Then if the rule changes you can write a new function or modify the existing one and the data itself doesn't have to change.

  • How to execute a string formula and assign the result to a number field

    How to execute a string formula and assign the result to a number field
    Hi,
    we have a function that returns a string like this:
    '(45+22)*78/23'
    After we should calculate this string and assign the value to a numeric block field
    Example:
    k number(16,3);
    k:=fun1('(45+22)*78/23'); where fun1 execute and translate to number the string.
    Does exist a function like fun1 ??
    How can we do ?
    Regards

    Hello,
    this is the code that does the job:
    SQL> set serveroutput on
    SQL> DECLARE
    2 ch VARCHAR2(20) :='22+10' ;
    3 i NUMBER ;
    4 BEGIN
    5 EXECUTE IMMEDIATE 'select ' || ch || ' from dual' INTO i;
    6 dbms_output.put_line ('i = ' || TO_CHAR(i));
    7 END ;
    8 /
    i = 32
    Procédure PL/SQL terminée avec succès.
    SQL>
    just you have to do is to create a small stored function that take the string to calculate and return the number result
    Francois

Maybe you are looking for

  • A question about SKTO in condition tab

    Hi all, i am a starter in SD, and trying to figure out how to create a sales deal, so i created one sales deal with payment term ZB03. And conditon K007 5% discount for customer1 ist created under this sales deal. customer1 master data has payment ZB

  • QuickTime 6.5.2 won't open media files......

    I just downloaded and installed QuickTime 6.5.2 and it will not open media files. Just gives me the old broken film icon with the Apple symbol in it. Anyone got any suggestions? I am running Win98 on a 2 Ghz Athlon based machine. Got half a gig of SD

  • Cursor focus during a PPR event

    Hi, I have two messageTextInput columns (lets say text1 and text2) inside a table region. When a user enters a value in text1 and do a tab out, I fire a PPR event and set some attributes in my VO. The problem is: after it is done, the cursor focus do

  • Export Billing Configuration with CIN and Foreign Trade Data

    Hi, I need detail configuration of Export billing with CIN and foreign trade data for my understnading the configuration process for export billing process. Thanks in advance

  • HT1212 i dont want to restore my ipod. is there another way?

    Is there anywhere in idaho that will be able to unlock my ipodtuch 4th gen. without restoring it?