Using a varchar field as number on ui

Hello
In one of the requirements we got to use a varchar field in db to store as number in UI. The user may specify + or - in the begining and it can be number up to 2 decimal places.
So, how to achieve this?
We are using jdev 11.1.1.6.2

may be have a transient field with number datatype and use af:convertNumber with minFractionDigits and maxFractionDigits to 2. it would take - not sure about + sign (might remove automatically). convert this as string and try saving it with your actual field.

Similar Messages

  • Using a varchar field to select statement

    Hi all
    I have a single row and single column table
    T(command varchar2(4000))
    and the row is
    sno,name
    And I have another table T1(sno number,name varchar)
    Now can any body tell how can i use command column in table T to query T1 to get sno,name from T1
    I am looking for a select statement like this
    select (select command from T) from T1;
    but it is printing out the data in T i mean sno, name
    This is a copy of thread Selecting output of a select statement
    but explained more clearly
    Thanks,
    ganesh.

    I don't know why your tables are designed like this but what I think you want to do is join T1 with the data in T.
    select sno, name from T1
    where sno in (select substr(command,0,instr(command,',')-1) from T)
    and name in (select substr(command,instr(command,',')+1) from T);
    substr returns a string up to a position
    instr returns the position of a string
    and the other post you refer to as about as confusing as your one.

  • Use of nvarchar field in a Unicode database

    Hi,
    I'm using an application (SPI) where, in the manual of this application, is clearly stated under the chapter to create the Oracle database:
    i. Under Database Character Set, select Use Unicode (AL32UTF8).
    ii. Under National Character Set, select AL16UTF16 (the default).
    Then, in the latest version of SPI all varchar fields where changed to nvarchar fields.
    Now I'm wondering what the advantage could be of this setup.
    In a Unicode database, I can already store any international character set in a varchar field, so why would they use nvarchar?
    I do see the disadvantage, because in various SQL's against this database I get ORA-12704 (Character set mismatch errors) when using
    select
    tag from ..
    union
    select '-' from ... instead I have to add a cast
    select
    tag from ..
    union
    select cast('-' as nvarchar2(1)) from ...

    Now I'm wondering what the advantage could be of this setup.Hard to say but plenty of disadvantages.
    See [url https://forums.oracle.com/forums/thread.jspa?threadID=2302983#9955254]Dear Gurus: Can u pls explain the difference between VARCHAR2 & NVARCHAR2??

  • Best practice to define length for varchar field of table in sql server

    What is best practice to define length for a varchar field in table
    where field suppose Remarks By Person  varchar(max) or varchar(4000)
    Could it affect on optimization in future????
    experts Reply Must ... 
    Dilip Patil..

    Hi Dilip,
    Varchar(n/max) is a variable-length, non-unicode character data. N defines the string length and can be a value from 1 through 8,000. Max indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage size is the actual length of the data entered
    + 2 bytes. We always use varchar when the sizes of the column data entries vary considerably. While if the filed data size might exceed 8,000 bytes in some way, we should use varchar(max).
    So the conclusion is just like Uri said, use varchar(max) or varchar(4000) is depends on how much characters we are going to store.
    The following document about varchar in SQL Server is for your reference:
    http://technet.microsoft.com/en-us/library/ms176089.aspx
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Comparing 2 varchar fields

    I have a procedure which accepts a varchar field as input and compares it with each value in a table. how do I code it.
    e.g. proc1(xx IN varchar, yy OUT)
    --say column name is abc then
    where abc = xx;
    Dosent giving any output.

    here it goes
    SQL> ED
    Wrote file afiedt.buf
    1 CREATE OR REPLACE PROCEDURE
    2 COMPARE_VARCHAR_FIELDS(XX IN VARCHAR,YY OUT VARCHAR)
    3 IS
    4 A NUMBER:=0;
    5 BEGIN
    6 FOR I IN (SELECT * FROM AX WHERE X=XX)
    7 LOOP
    8 A:=A+1;
    9 END LOOP;
    10 IF A>0 THEN
    11 YY:=XX||' FOUND '||A||' TIMES';
    12 ELSE
    13 YY:=XX||' NOT FOUND';
    14 END IF;
    15* END;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> ed
    Wrote file afiedt.buf
    1 DECLARE
    2 Z VARCHAR2(40);
    3 BEGIN
    4 COMPARE_VARCHAR_FIELDS('x',z);
    5 dbms_output.put_line(z);
    6* end ;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on
    SQL> /
    x FOUND 3 TIMES
    PL/SQL procedure successfully completed.

  • Clob's versus Varchar fields

    It's been a day of learning. I found out that when Kodo gets a
    columnlength of -1 for a String field, it will ask the Dictionary for
    the sql for generating a Clob. Also when Kodo finds a positive
    columnlength it will call getLenString on the dictionary.
    We're using MySQL and in this case, when the column-length of a String
    is set to -1 this creates a TEXT field and when the column-length is
    positive this creates a VARCHAR(column-length) field.
    When querying the database, Kodo once again turns to the meta data. When
    the column-length has been set to -1 Kodo does a separate query for each
    text field. If the column-length is positive, Kodo includes the field in
    it's default-fetch-group.
    Am I correct so far?
    The problem I have is that when a query for a certain field is
    performed, I want it to be in the first group fetched. It is always
    needed and not that large at all. It will at most be 1500 characters. In
    SQL Server and possibly others, I can put the column-length at 1500 and
    wind up with a varchar field of 1500 characters long. MySQL however,
    does not support anything over 255 characters for a varchar field.
    So, I need to create a field of type TEXT to allow it to contain more
    than 255 chars. However, I do not want a separate query for the field
    since it won't be that big anyway.
    I've been able to get this working using the column-length -1 at schema
    time and the value 1500 at runtime. This is not at all convenient and
    will very likely result in a wrong schema being created or the wrong
    query being run in the long run.
    Is the solution I just mentioned the only one, or are there other scenarios?
    Thanks in advance,
    Martin van Dijken

    Martin-
    Your analysis is exactly right. Kodo 3.0 allows a lot more latitude in
    how this behavior is defined.
    One way in which you might be able to get around this problem is to
    leave the "column-length" attribute to -1, but manually force the
    mapping to not be the ClobMapping (which is the mechanism by which Kodo
    knows to issue a separate query for the object). You can do this by
    setting the "custom-mapping" field-level metadata extension to
    "com.solarmetric.kodo.impl.jdbc.ormapping.ValueMapping".
    I'll be interested to know if this works for you.
    In article <[email protected]>, Martin van Dijken wrote:
    It's been a day of learning. I found out that when Kodo gets a
    columnlength of -1 for a String field, it will ask the Dictionary for
    the sql for generating a Clob. Also when Kodo finds a positive
    columnlength it will call getLenString on the dictionary.
    We're using MySQL and in this case, when the column-length of a String
    is set to -1 this creates a TEXT field and when the column-length is
    positive this creates a VARCHAR(column-length) field.
    When querying the database, Kodo once again turns to the meta data. When
    the column-length has been set to -1 Kodo does a separate query for each
    text field. If the column-length is positive, Kodo includes the field in
    it's default-fetch-group.
    Am I correct so far?
    The problem I have is that when a query for a certain field is
    performed, I want it to be in the first group fetched. It is always
    needed and not that large at all. It will at most be 1500 characters. In
    SQL Server and possibly others, I can put the column-length at 1500 and
    wind up with a varchar field of 1500 characters long. MySQL however,
    does not support anything over 255 characters for a varchar field.
    So, I need to create a field of type TEXT to allow it to contain more
    than 255 chars. However, I do not want a separate query for the field
    since it won't be that big anyway.
    I've been able to get this working using the column-length -1 at schema
    time and the value 1500 at runtime. This is not at all convenient and
    will very likely result in a wrong schema being created or the wrong
    query being run in the long run.
    Is the solution I just mentioned the only one, or are there other scenarios?
    Thanks in advance,
    Martin van Dijken
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Any SAP standard report is used to retrieve the inventory number based Asse

    Hi all
    Any SAP standard report is used to retrieve the inventory number based Asset ID.
    Please help us to provide the standard report.
    Regards
    K.Gunasekar

    Hi,
    Create the Sort version with field Inventory no, so that you can display Inventory no details in all Asset report.
    You can get "Inventory no" details by including field "INVNR" in Sort versions for Asset reporting(T.code - OAVI).
    Hope this information helpful for you.
    Thanks & Best Regards,
    M.Ganesan

  • Use of Sort Field in equipment Master

    Dear All
    What is the use of SORT field in Equipment Master Record

    Dear Kumar Sahoo,
    This field is for identification purpose and generally give similar technical objects
    example:if you have so motors like lathe and drilling and lifting and milling etc thease all motors are same motors and if you want see the list you can give sor name then see, otherwise you have to give each number and find out
    some  more benefit is you can list sorting and unic identification of similar objects
    generally using internal purpose, i mean there is no relation of external procurement or warranty or any outside of company activiteis.
    Hope this may helps you
    Prem

  • How to filter the result by using a Quarter fields

    How can i fiter the output by using the quarter field for example I want to display the output for letting date 07060801 and quarter 1(Q1-2007) thanks
    SELECT tab.description, tab.itmenum, tab.units, tab.countyname, tab.datelet,'Q'||tab.Quarter,
           tab.contid, tab.vendor, tab.vendorname, tab.quantity, tab.EngineersPrice ,
            (tab.EngineersPrice*tab.quantity) EngineersTotal, tab.vendorsPrice,
           (tab.quantity * tab.vendorsPrice) VendorsTotal
      FROM (SELECT   INITCAP (i.idescrl || '  ' || e.isupdes) description,
                     e.isupdes, i.idescrl, SUBSTR (e.eiitem, 1, 4)|| '.'|| SUBSTR (e.eiitem, 5, 9) itmenum,
                     e.eiitem, func_get_unit_name (iunits) units,
                     INITCAP (func_get_county_name (p.ccnty1)) countyname,
                     b.datelet,TO_CHAR(b.datelet, 'Q-YYYY') Quarter, p.contid, d.vendor, l.CALL, g.csecnum, e.iplineno,                         
                     SUM (e.iqty) quantity,
                     (TRIM (d.vendor) || ' : ' || INITCAP (v.vnamel)) vendorname,
                           (SELECT br.bidprice
                        FROM bidtabs br
                             --------------------Select Letting Dates-------------------------------
                       WHERE br.letting  between '&lettingDatePlease' and  '&lettingDatePlease2'
                         AND br.lineflag = 'L'                                   
                         AND br.iplineno = e.iplineno
                         AND br.CALL = l.CALL
                         AND br.vendor = d.vendor) vendorsPrice,
                         (SELECT DISTINCT pi.price
                                 FROM propitem pi
                                WHERE pi.contid = p.contid
                                         AND pi.lineflag='L'
                                         AND trim(pi.iplineno) <> ' '
                                  AND trim(pi.iplineno) = trim(e.iplineno)) EngineersPrice
                FROM itemlist i,
                     estitem e,
                     estcatg g,
                     propproj x,
                     proposal p,
                     letprop l,
                     bidlet b,
                     bidders d,
                     vendor v
               WHERE p.contid = x.contid
                 AND x.pcn = g.pcn
                 AND e.pcn = g.pcn
                 AND e.cn = g.cn
                 AND i.item = e.eiitem
                 AND i.ispecyr = p.cspecyr
                 AND e.iplineno <> ' '
                 AND e.eiitem <> '2550601/01000'
                 AND e.eiitem <> '2565601/00031'
                 AND e.eiitem <> '2565601/00033'
                 AND e.eiitem <> '2402601/01000'
                    -----Select Item Number----------
                 AND e.eiitem = '&itemNumberPlease'
                 AND l.lcontid = p.contid
                 AND l.letting = b.letting
                 AND l.letting = d.letting
                 AND l.CALL = d.CALL
                   -- AND l.LETSTAT='A'---------------------why 6/22 is not included----------------------------work with this-------------------------
                 AND d.vendor = v.vendor
                    ------Select Letting Dates--------
                 AND b.letting between '&lettingDatePlease' and  '&lettingDatePlease2'
            GROUP BY p.contid,
                           d.vendor,
                     g.csecnum,
                     e.iplineno,
                     SUBSTR (e.eiitem, 1, 4) || '.' || SUBSTR (e.eiitem, 5, 9),
                     b.datelet,
                     l.CALL,
                     e.eiitem,
                     (i.idescrl || '  ' || e.isupdes),
                     func_get_unit_name (iunits),                
                     iunits,
                     p.ccnty1,
                     i.idescrl,
                     e.isupdes,
                     i.idescrl,
                     v.vnamel,
                     e.isupdes)  tab
    DESCRIPTION     ITMENUM     UNITS     COUNTYNAME     DATELET     'Q'||TAB.QUARTER     CONTID     VENDOR     VENDORNAME     QUANTITY     ENGINEERSPRICE     ENGINEERSTOTAL     VENDORSPRICE     VENDORSTOTAL
    Mobilization        2021.501/00010     LUMP SUM     Hennepin     3/30/2007     Q1-2007     060048              ALS0010            ALS0010 : Ames / Lunda / Shafer (Jv)     1     11376150     11376150     14357900     14357900
    Mobilization        2021.501/00010     LUMP SUM     Hennepin     3/30/2007     Q1-2007     060048              MP0001             MP0001 : Mccrossan/Pcl (Jv)     1     11376150     11376150     15600000     15600000
    Mobilization        2021.501/00010     LUMP SUM     Wright     5/18/2007     Q2-2007     070002              C320               C320 : Central Specialties Inc     1     130459     130459     637860     637860
    Mobilization        2021.501/00010     LUMP SUM     Wright     5/18/2007     Q2-2007     070002              D420               D420 : Duininck Brothers Inc     1     130459     130459     362000     362000
    Mobilization        2021.501/00010     LUMP SUM     Wright     5/18/2007     Q2-2007     070002              H151               H151 : Hardrives Inc     1     130459     130459     516000     516000
    Mobilization        2021.501/00010     LUMP SUM     Wright     5/18/2007     Q2-2007     070002              H438               H438 : Hoffman Construction Company     1     130459     130459     255000     255000
    Mobilization        2021.501/00010     LUMP SUM     Wright     5/18/2007     Q2-2007     070002              K0037              K0037 : Knife River Corporation - North Central     1     130459     130459     290953.37     290953.37
    Mobilization        2021.501/00010     LUMP SUM     Wright     5/18/2007     Q2-2007     070002              M0027              M0027 : Midwest Contracting Llc     1     130459     130459     285000     285000

    Hi gourous,
    I am sorry, my question is a little bit more complex. I hope I may repost here, without opening another thread. Thank you for your understanding.
    The EQUIPE_ID column of the table refers to a team. This id is returned by a select list named :P60_EQUIPE_ID which select all the EQUIPE_ID available. Then if one choose a team in this select list, the choosen EQUIPE_ID is returned. If nothing is selected in the select list, then a null value is returned.
    The AGENT_ID refers to a person. This id is returned by a select list named :P60_AGENT_ID, which returns all the members of the previously selected EQUIPE_ID. If nothing is selected, then a null value is returned.
    A team may have several persons belonging to that team.
    I would like that if a TEAM is selected, without selecting an agent in the :P60_AGENT_ID select list (returning a null value in this case), then all the people belonging to that theam will be retrieved by the select QUERY of a report.
    Then one could refine the query by selecting a person in the :P60_AGENT_ID select list in order to view only the people of that team in the report.
    To resume :
    IF EQUIPE_ID is NULL -> all the teams and all the persons are displayed in the report.
    IF EQUIPE_ID is NOT NULL and :P60_AGENT_ID is NULL -> All the people of that selected team appears on the report
    IF EQUIPE_ID is NOT NULL and :P60_AGENT_ID is NOT NULL -> The report displays only the results of the query for that person of that team.
    Thank you for your kind help !

  • Dividing sum of varchar fields?

    I'm using SQL Server 2014 and I have the following table containing two varchar fields I need to sum and divide:
    CREATE TABLE.[VMs](
    [VMID] [int] IDENTITY(1,1) NOT NULL,
    [vCenter] [varchar](100) NULL,
    [VMName] [varchar](100) NULL,
    [Template] [varchar](100) NULL,
    [PowerState] [varchar](100) NULL,
    [ClusterName] [varchar](100) NULL,
    [Disk] [int] NULL,
    [DiskPartition] [varchar](70) NULL,
    [DiskSizeGB] [decimal](10, 3) NULL,
    [Hostname] [varchar](100) NULL,
    CONSTRAINT [PK_VMs] PRIMARY KEY CLUSTERED
    [VMID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    I'm trying to get the distinct sum of 'VMName' and 'Hostname' to get the count of each, and then divide the 'VMName' count by 'Hostname' count on a per 'vCenter' basis.
    I'm not sure how to perform calculations against the varchar fields and any help would be appreciated.
    Thanks in advance
    Adam

    This is the main query, the top portion was sample data I just put based on your provided data
    ;With CTE
    AS
    SELECT
    vCenter
    ,COUNT(DISTINCT VMName) As CountVMName
    ,COUNT(DISTINCT HostName) As CountHostName
    FROM
    @myTable
    GROUP BY
    vCenter
    SELECT *, (CASE WHEN CountHostName <> 0 THEN CountVMName / CountHostName ELSE 0 END) As CountPerVCenter
    FROM
    CTE
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • Problem with field "batch number" and table "et_item" at  BBP_CONF_CHANGE

    Hi experts!,
    I have a problem when I use the badi BBP_DOC_CHANGE_BADI and with the method BBP_CONF_CHANGE.
    I want to fill the field "batch number" at web SRM with the PO number, I thought to write it at suitable or appropriate field at table "et_item" but this table has not any similar field which I can write it.
    Thanks in advance.
    Best Regards.

    Hello,
    we cannot fill the BATCH field because it is not available in the table ET_ITEM in the method BBP_CONF_CHANGE.
    Do you know how can we fill a default value in this field when the user is creating or modifying a confirmation item?
    Thank you.
    Best regards.

  • Field Tax Number 1 in VA01

    Hi I am using the BAPI sd_salesdocument_create to create sales orders and need to pass the field Tax Number 1 (STCD1) for the case of a customer CPD. I'm using the table EXTENSIONIN as follows but not recorded the field.
    EXTENSIONIN-STRUCTURE = 'VBPA3KOM'
    EXTENSIONIN-VALUEPART1 = '          00000010406707933'
    Thanks.

    hi dvalesp,
    Have you tried placing a breakpoint in SD_SALESDOCUMENT_CREATE at SE37?
    perform ms_move_extensionin tables extensionin
                                         sales_items_in
                                         sales_schedules_in
                                  using
                                         sales_header_in.
    This is in line 222-226 of the source code of the BAPI.
    Then check subroutine ms_move_extensionin of include program LVBAKF0C.
    * BAPI enhancement <b>for</b> CPD Customer Information <b>for</b> table VBPA3
          WHEN 'VBPA3KOM'.
            CATCH SYSTEM-EXCEPTIONS conversion_errors  = 1.
              MOVE extensionin+lv_length TO wa_vbpa3kom.
              APPEND wa_vbpa3kom TO ex_vbpa3kom.
            ENDCATCH.
        ENDCASE.
      ENDLOOP.
    try to check what is being transferred in the code "MOVE extensionin+lv_length TO wa_vbpa3kom." You may try to change the value of wa_vbpa3kom during debugging and continue the program to check if it works. If it works, that means all you have to change is the values inside extensionin.
    Regards,
    Paul

  • Add new field (Check number) in Txn FBL1N

    Hi SAP,
    Is there any way or configuration i need to do so that i can add new field (Check number) in vendor line item (Txn FBL1N)?
    Here the details of the field (Check number):
    Field name: CHECT
    Table name: PAYR
    Program name: SAPMFCHK
    Appreciate your help. I will give points who help me solve this problem.
    TQ
    Regards,
    Nazrul

    Hi,
    For that you Go through this below method.
    I tested this senario it is working properly.
    Go T.code  O7E4
    IMG > Financial A/cing > Accounts Receivable and Accounts Payable > Vendor Accounts > Line Items > Display Line Items > Define Line item without ALV>Choose Selection Fields
    Account type  K
    Insert Field Name whichever you want
    Save
    Next Go to the FBL1N.
    Select change layout button and select check number from
    Save the layout
    That is enough For that
    If Have any doubt regarding this feel free to ask
    May be this information is useful to you
    Regards
    Surya

  • Create material master using BAPI .(Mat. internal number range)

    I would like to create the material using BAPI. (Material is internal number range).
    I am trying to create the material using BAPI  BAPI_MATERIAL_SAVEDATA, but material number is required field as per BAPI documentation .
    Can you please suggest me the function modules or BAPI to load materials which are in internal number range.
    Regards
    Badari

    Hi ,
    Use FM 'MATERIAL_NUMBER_GET_NEXT' to get next available material #.
    You can use that material # in BAPI 'BAPI_MATERIAL_SAVEDATA'.
    Cheers,
    Vikram

  • Using calculated time field in graph?

    Hello All,
    Hope you can help.
    I am trying to show a graph with  "Total Time spent on Phone" (Hrs:Min:Sec) on the y axis and "Month" on the X axis.
    However the data I am using for 'time' in the database is actually a sum of a 4 number fields.So I have converted this to a date/time format that gives me the correct info as Hrs:Min:Sec. Unfortunately when I use this formatted field in the graph it only allows me to summarise the field and this only allows me to 'Count' or 'Distinct Count' the information which is no help to me at all. If I use the original 'number' formatted field that I originally summed it shows graphically the information I require but the scale on the Y axis is then displayed as a numerical scale which doesn't then show the Hrs:Min:Sec that I need. If I go into the axis format I can change the view to time but it then displays 00:00:00.
    Can anyone offer a way round this.
    Thanks in advance Simon

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551

Maybe you are looking for