Mapping an object's property to a field computed from 2 database fields

Hi,
Is there a way to do a WorkBench mapping of a business object's property to a field computed from 2 separate database fields?
If not in WB, how would you do that?
Thanks,
Michal

You could define this mapping through a TransformationMapping using you own code in the mappings transformer to divide the values. However you are probably much better off to just map the two values directly, and add a method in your object model to get the rate buy dividing the values.
If terms of being able to order-by the calculated value in the a TopLink query, mapping the calculated value using a transformation mapping would not help this.
To do this order by you can use,
query.addOrdering(ExpressionMath.multiply(ExpressionMath.divide(builder.get("numberOfSuccess"), builder.get("numberOfAttempts")), 100);

Similar Messages

  • Returned data from database field having data type CLOB

    hi..
    i hv table having CLOB field type ... having 12000 char length ... data is present in the field... but when i do select on that field it only returns the limited data from that field for any given row...
    pls let me know wuts may b the problem...
    cheeerrss..

    Are you running the select from SQL*Plus? If so check out the [SET LONG|http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#sthref2800] parameter.
    HTH!

  • Crystal Reports XI Web Elements - populate WESelect element values from database field

    <p>Hi,</p><p>I am using Web Elements with Crystal Reports XI. I need to know how to populate the ElementValues and ElementDisplays arguments of the WESelect function from a database field. </p><p>In the function expert when I click on the ElementsValues and ElementDisplays values a drop down appears which will let me select a field or formula. However, when I try saving and leaving the formula workshop an error message is generated.</p><p> "A subscript must be between 1 and the size of the array".</p><p>I assume this is because the WESelect function is looking for the "|" separator in the ElementValues and ElementDisplays arguments.</p><p>Please advise.</p><p>Thanks</p>

    hello,Â
    in the webelements.zip download you should find a DCP report which shows the method for "rolling up" data using a subreport and passing these to a select control using shared variables.
    basically a string running total rolls up the values at run time and character separates them for use by the controls. for any type of select (drop down menu etc.) controls all of the values have to be made available before the main report is run so that's why you use this techique. you can think of it this way...instead of having an asp page that runs a database query and then populates a javascript array for the control, the subreport rolls up the values and passes them to the control.
    other types of controls that you wish to place directly on a group header or details section can be run off of main report fields or formulae...e.g. you can place a checkbox control on the details section without having to roll up the data in advance.
    by just putting a field name in the parameter for a select control, you will only get one value per control.
    i hope that this makes sense as it takes a bit to get used to at first,
    jamie

  • Bank Key field change from database table

    Dear All,
    At our client, 4 house banks are maintained. The bank keys entered for these are not BSR Codes but something like 100,200,300,400.
    This is not correct as we need to maintain BSR Code in Bank Key field as it is required on Form 16 A (TDS Cetificate)
    The Bank Key field is in display mode. I am thinking of changing wrong value from database table T012 & BNKA .
    Has anybody done this before? Will it affect my past or future transactions?
    Thanks & regards,
    Gov

    Dear Gulshan,
    What you are saying is correct & I subscribe to your view also.
    Creation of House Bank all over again seems to be one of the better options.
    We tried doing one more thing & which is working fine on Development.
    Our primary requiremnt is to have BSR Code on the From 16 A. System picks up the Bank key for this.
    We copied the standard Form 16A & created a Z. Then abaper created a subroutine. It is like when Bank key 100 comes to Form16A, replace it with say 0098500 (Correct BSR Code of the Bank)
    This helped to get the correct BSR Code in Form 16A & saved us from recreation of House Bank data.
    Your comments are welcome.
    Regards,
    Gov

  • Setting field value from antother field

    I am having problems setting the value of a field depending on the entry of a previous drop down field.
    I am creating some wizard pages. On one page i wish a drop down list to populate another field. The drop downlist is unbound. (I have tried doing this with bound field aswell). To do this I have the Depends on Item of the target field to depend on the dropdown list field, so that the appropriate values are updated. (i have tried with the target field being bound and unbound aswell not that it should matter).
    I have then updated the VO (view object) adding transient fields when the fields are unbound. Then i updated the view row class. The setter of the drop down field was used to set the value of the target field. (Using the setter of target field). I added system.out.println and the fields are called and set accordingly. ie getters and setters are correct.
    However when i run the screens the target field value is not set with the value within the getter of target field.
    Could you advice if this is a bug or whether i should be coding this in a different manner. (if it is a bug and you tell me when it is likely to be fixed and any alternative work arounds).
    Cheers
    Alan

    Alan,
    Not really a bug, but "missing functionality". The problem is that ADF Faces will only refresh a UI Component value from the underlying model binding value when you submit the request with immediate="false", OR when you explicitly call resetValue() on the component.
    We have added a new boolean item-level property "Clear/Refresh Item When Depends-On-Item Changes" in the latest build.That property will do the trick for you: it will clear the value and call resetValue on the UI Components of the dependent items, BEFORE the depends-on-item model value is updated. So, in your case, the setter method of your depends-on-item attribute will update your dependent item after JHS cleared the item, and you will see the new value right away because UIComponent.resetValue() was called as well.
    Steven Davelaar,
    JHeadstart Team.

  • How to persist data in the object n memory after fetching it once from database and use it with linq

    Hi,
    I have some data from the database around 8 to 10 records .
    These records are interrelated and I need to show cascade drop down.
    I want to get the records from the database using c#.
    And then based on certain events on the page want to use linq over the same data without having to get the data from the data base again.
    i.e 
    ProductName
    Product Plan
    Product type
    Monthly
    Annually
    pordA
    Gold
    Individual
    1
    5
    pordA
    Gold
    Spouse
    2
    6
    pordA
    Silver
    Individual
    3
    7
    pordA
    Silver
    Spouse
    4
    8
    Prod B
    Platinum
    Individual
    5
    9
    Prod B
    Platinum
    Spouse
    6
    10
    Prod B
    Gold
    Individual
    1
    5
    Prod B
    Gold
    Spouse
    2
    6
    pordA
    Silver
    Individual
    3
    7
    pordA
    Silver
    Spouse
    4
    8
    pordA
    Platinum
    Individual
    5
    9
    Now on page load I want product name in drop down.
    Based on the productName selected i want to show Product Plan in another drop down and based on prduct plan want to show prduct type in drop down and then the annual and monthly in drop down.
    I want to get all the records of  prod A and then using  linq to object  load the drop downs instead of running query to database.
    How can I keep the records available across the function calls.
    Regards
    Vinod

    This is mostly a ASP.NET question. You get better answers if you post it in ASP.NET forum.
    This is my answer:
    Session is not a suitable choice, since each user will have a duplicate of the data. Cache is a better option.
    You can put something in Cache option and retrieve it from Cache similar to using Session. This is the manual method of caching and management of the cache content is on yourself.
    public List<Product> GetAll()
    List<Product> products = null;
    if (Cache["Products"] == null)
    DataSet data = RetrieveProducts();
    products = ConvertProductsDataSetToObject(data);
    Cache.Insert("Products", products, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
    else
    products = (List<Product>)Cache["Products"];
    return products;
    When putting something in the cache, you should set its expire time. But one thing that is more important over this is to clear the cache when your data is changed in the data store (e.g. database).
    public void UpdateProduct()
    // update product in the database
    // clear the cahce, so that the next request for Products, receives a fresh copy of the data
    Cache["TestItem"] = null;
    Other than using cache manually, there are also some helper funcationalities that manage cache automatically for you, based on the technology you use (ASP.NET Web Forms or ASP.NET MVC). For example in ASP.NET Web Forms you can ask ASP.NET Web Forms engine
    to cache the output of a User Control automatocally by adding OutputCache directive to the user control. In ASP.NET MVC you can you [OutputCache] attribute and apply it to actions.
    [OutputCache(Duration = 86400, Location = OutputCacheLocation.All)]
    public ActionResult Index()
    var model = ProductBL.GetAll();
    return View(model);
    Also, there is a concept named cache dependency, by which you can specify a dependency for the item being cached. When the condition is met, the cache automatically invalidates and clears.
    There are three kinds of cache dependency:
    Item dependency: make cached data dependent on another cached data
    File dependency: make cached data dependent on a file
    Sql dependency: make cached data dependent on the result of a SQL query

  • "Asset main no. text " field derived from "Description" field

    Hello,
    I have a problem with asset master data.
    When I enter the description of the asset then it is automatically copied to Asset main no. text field.
    How could I customize it not to be copied?
    Thanks a lot in advance

    Hi,
    SAPLAIST is the SAP Program name which provides this functionality. Set ur break point on LAISTF89 INCLUDE under SAPLAIST.
    You will find some statements between 19 to 25 lines, which states that if Main number(ANLH-ANLHTXT) status i.e. SDRO is active then check its value if it is initial then copy its value from ANLA-TXT50 description column.
    ANLH-ANLHTXT = ANLA-TXT50.
    I checked about this functionality under SAP 3.1.. there its not available.....
    So its a kind of Gift!!!!! in SAP 6.0....! Enjoy....... it.............
    Thanks
    Guneet.

  • In Project stock valuation during GR MAP is picked up from VMVER field

    Hi!
    We are facing an issue during the GR of Material in Production order.
    I will explain the scenario:
    The main material is valuated in MAP (Moving average price).
    On creation of the production order the planned value is coming ok ( summation of components).
    As it was a project valuation, the MAP values are getting stored in the table QBEW.
    The point of concern is at the time of doing GR the actual value is getting picked up from the field VMVER (=MAP/Period unit price in previous period)
    and not from the field VERPR (= MAP/Period unit price).
    As per the scenario the system must consider the latest MAP value that is from VERPR and not from VMVER.
    Can't find out what setting is affecting this selection.
    Abhra

    Hi,
    I am still having problems with this issue. The material is extended for plant 1200 and a valuation class and project stock valuation class have been set.
    Is there a configuration setting required?

  • BOXI3.0: Formula for subtract/deduct one day or more from date field

    Greetings. Its Alias.
    I have one question. Actually I already post this question but at designer forum.
    I am using SQL.
    Example I have Order Date field and from this field I want to subtract the date by minus one day or two days or three days, etc.
    I got the solution for designer (example):
    DATEADD (dd , -3, EPJ_IPMS.dbo.DO_DATA.DO_DATE_D)
    But at webi level it does not work.
    I also do not understand why at designer and webi level may have different SQL select statement.
    Can someone help me please.
    Best regards,
    Alias

    Hi there Prashant.
    In my case here is I am using Microsoft SQL Server Enterprise Manager and the data is save inside it.
    The Designer and Webi are using same SQL database.
    I also created an Object at Designer and the result is good.
    But say if I don't want to create the object at Designer and let user create their own variables at webi.
    Meaning to educate user to put the variable and formula themselves.
    This is where the SQL statement a I mentioned earlier cannot be used at webi.
    Best Regards,
    Alias

  • To read all the database fields used in a Crystal report 10 file using Vb 6 Code

    Hi
    Iam in development of an Application in Visual basic which lists all the
    database fields used in a particular report (crystal 10)
    In simple i need to show all the checked fields in the database fields section in field explorer section of the crystal report file.
    regards
    venkateshG

    Please re-post if this is still an issue to the Legacy Application Development SDKs Forum or purchase a case and have a dedicated support engineer work with you directly

  • Urgent......  how to select few fields, from database table, (dynamic ita.)

    Dear all experts,
    I am able to populate all fields data from database table, using dynamic table creation.
    eg,
    SELECT *    FROM (w_tabname)    INTO    TABLE <t_itab>.
    where w_tabname is the table name given by the user, and t_itab is field symbol.
    but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
    <b>I can</b> take those fields from file into any internal table,
    but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
    i have tried with field symbol, it is not working (as per my knowledge.)
    do i need to create any structures dynamically ?
    Can anybody please help in this regards ?
    Your help will be surely rewarded with points.
    Waiting for reply..
    Regards
    Vinay

    Hi Vinay ,
    Adding to the below code , you can use some more fields in the select stmt as below:-
    REPORT ychatest.
    PARAMETERS : p_field1 LIKE dd03l-fieldname,
                             P_field2 LIKE dd03l-fieldname,
                             p_table LIKE dd03l-tabname.
    FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
    SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
    Now p_field1 & p_field2  belong to the same table since you have give the user to enter only one table name.
    This should work fine.
    please try & let me know .
    Thanks & Regards,
    Daniel

  • Irrelevant id's under 'Database Fields' for BW query

    Hi all,
    I am new to Crystal reports and have a problem.
    I installed Crystal Reports 2008 and as integration kit (with BW), i installed 3.1 version.
    I am trying to connect a bw query to the Crystal Reports.
    Now i can connect a bw query, but in 'Fields Explorer' under 'Database Fields' i can not see proper names. I have already selected 'show description ' setting.
    There are items like, Cube creation time, cube type, data update time etc.. and for key figures, there are lots of items that starts with M~[Measures].....
    Some of my collegues have the same version and it is working just fine. So I wonder, what is wrong with mine.
    What can be the problem?
    Thanks
    Ozan

    Settings button can be found in the SAP toolbar.
    Also in Menu bar, you can see 'Settings' under SAP menu.
    By the way, integration kit has to be installed beforehand.

  • Mapping a property to a Studio Database Field

    Can anyone tell me how I can map one of our user properties to a studio database field. We would like for the record browser portlet to show the user's "Employment Level" without having the user enter that info in the form. Thanks.

    Unfortunately, this isn't really supported with Studio. The only thing you might try is doing some type of database level hack -- either via a synchronization or trigger.
    ...stephan

  • DisplayAuthor managed property does not map to any crawl property, why?

    I just discovered the out of box  - DisplayAuthor managed property does not map to any crawl property, why is that? but it is still working fine when using this property as a refiner.....how does this work?

    Hi,
    The DisplayAuthor managed property is different. It is  multi-valued  but has no crawled properties mapped to it. However, it represents multiple authors for a document. There is the author that is stored with the properties of a document such
    as a pdf this is the original creator of the document, and then there is the SharePoint author of the document which is the the person who uploaded the document. So basically you can search on both using the DisplayAuthor.
    Besides, here is a similar post, you can use as a reference:
    https://social.msdn.microsoft.com/Forums/office/en-US/bdf5d8dc-0511-492c-8f51-9cd541cf70bd/what-does-the-displayauthor-value-in-the-search-refinement-json-object-represent?forum=sharepointsearch
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • Mapping an object using values from multiple tables

    Is it possible to use values looked up in other tables when mapping an object?
    For example: I have three tables. In table 1, I have fields for 'cityCode' and 'stateCode'. Table 2 is a state table which contains a list of stateCodes and corresponding stateIds. Table 3 is a city table with cityCodes listed by stateId (the city code is unique within the stateId but can be duplicated under other stateIds). Table 3 also contains the cityName for the matching cityCode/stateId pair.
    I am ultimately trying to match a cityName to a cityCode. I can't figure out how to tell toplink use the stateId returned when mapping Table 1 to Table 2 via stateCode when mapping cityCode in Table 1 to Table 3.
    Any help is greatly appreciated
    --matt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    What does your object model look like, do you have a single object with data from all three tables in it?
    <p>
    In general because the cardinality of the tables and usage does not match, I would not recommend using multiple tables to map this. Instead define a CityNameManager class that preloads and stores all of the city names for each state, (possible lazy initializing each set of cities per state). Your getCityName() method in your class would then just use this manager.
    <p>
    You could map the multiple tables but it may be difficult, and would most likely need to be read-only because I don't think you want to insert into the table2 or 3. You basically have a foreign key table1.stateCode => table2.stateCode, (table1.cityCode, table2.stateId) => (table3.cityCode, table3.stateId). You probably cannot define this in the Mapping Workbench, so would need to use the ClassDescriptor code API and an amendment method. If you can't get the foreign keys to work you can always use the descriptor multipleTableJoinExpression and define the join directly.
    <p>
    You could also define a OneToOneMapping to the CityName from your object using the cityCode and using a selectionCriteria() on your mapping to provide an expression that uses the getTable() method to join to the intermediate table.
    <p>
    <p>---
    <p>James Sutherland

Maybe you are looking for

  • New BT Vision Box - Why no Freeview HD?

    Why does the new BT vision box not support the DVB-T2 standard required for HD freeview? If BT is serious about competing with Sky and Virgin it needs to have 'live' HD services and better sports content. I understand that the content issue is being

  • Is there any command in Reports 6i - which is similar to raise form_trigger

    Is there any command in Reports 6i - which is similar to raise form_trigger_failure in forms6i.

  • Defination of Classic and Extended Withholding Tax

    Hi Gurus, Can anyone please explain the defination and exact use of Classic and Extended Withholding Tax difference. Thanks in advance. Regards, Dev Mahendra

  • Dropdown list in jsp

    Hi - I need some help.Here is my problem. I am writing drop down list in the jsp. I need to get the value of dropdown list and submit the form and again calling same jsp page. So i didn't see the same value in the dropdown list whichever i was submit

  • SWF files won't play in Firefox

    When opening SWF files from my computer, Firefox won't run the file, and instead opens a 'save' box so I can apparently re-save the file to my hard drive. This happens both when I drag and drop a file from Windows Explorer and also when I choose 'Ope