Calculated values: how to? Newbie question

Hi,
I have a view object with attributes X and Y (both numbers). How can I add a computed attribute (X*Y) ?
I tried to
- do "New" attribute in View Object wizard"
- then set flag Queriable to false
- remove that attribute from the SQL query
- edit the code of the method getX*Y() to return getX().multiply(getY());
but It doesn't work. I get an error (oracle.jbo.DMLException) JBO-26080: Error while selecting entity for Poste
----- LEVEL 1: DETAIL 0 -----
(java.sql.SQLException) ORA-00904: "AMOUNT_TOTAL" : invalid identifier
=> My questions are
1) How can I add a computed attribute on a view so it will work
2) I have a master and a detail view object. I want the master to have an attribute getAverage() computed on the detail row set. If I override the get() method in the master view object, how can I get the detail rows so I can compute it ?
The computing of these attributes are actually a little trickier than just a multiply operation. That's why I don't want to do it via a select sum().. or select avg(..).
Help much appreciated.
Rodolphe -

When you build a view link, you have an option to generate accessor (see the 'View Link Properties' panel on the View Link wizard).
You can also set the accessor name. The default is to generate an accessor to traverse from the master to detail.
When you call this accessor, it will return an oracle.jbo.RowIterator. Using that, you can traverse through rows in the detail. For example:
// This is on DeptView
public BigDecimal getAverageSal()
   // Get Emp's that belong to this Dept.
   // 'EmpView' is the view link accessor name.
   oracle.jbo.RowIterator iter = (oracle.jbo.RowIterator) getAttribute("EmpView");
   oracle.jbo.Row rowDetail;
   float salTot = 0.0;
   int count = 0;
   while ((rowDetail = iter.next()) != null)
      int sal = ((Integer) rowDetail.getAttribute("Salary")).intValue();
      salTot += sal;
      count++;
   if (count == 0) return new BigDecimal((double) 0.0);
   return new BigDecimal((double) (salTot / count));
}Thanks.
Sung

Similar Messages

  • How can i pass calculated value to internal table

    Hi
    i have to pass calculated value into internal table
    below field are coming from database view and i' m passing view data into iznew1
    fields of iznew1
                 LIFNR  LIKE EKKO-LIFNR,
                 EBELN  LIKE EKKO-EBELN,
                 VGABE  LIKE EKBE-VGABE,
                 EBELP  LIKE EKBE-EBELP,
                 BELNR  LIKE EKBE-BELNR,
                 MATNR  LIKE EKPO-MATNR,
                 TXZ01  LIKE EKPO-TXZ01,
            PS_PSP_PNR  LIKE EKKN-PS_PSP_PNR,
                 KOSTL  LIKE EKKN-KOSTL,
                 NAME1  LIKE LFA1-NAME1,
                 NAME2  LIKE LFA1-NAME2,
                 WERKS  LIKE EKPO-WERKS,
                 NETWR  LIKE EKPO-NETWR,
                 KNUMV  LIKE EKKO-KNUMV,
                 GJAHR  LIKE EKBE-GJAHR,
    and now i want to pass
    one field ED1  which i has calculated separatly and i want to pass this value into iznew1
    but error is coming that iznew1 is a table with out header line  has no component like ED1.
    so how can i pass calculated value to internal table iznew1,

    When you declare your internal table , make an addtion occurs 0
    eg . data : begin of iznew occurs 0 ,
                    fields ...
       add the field here ed1.
               end of iznew.
    now when you are calculating the value of ed1,
    you can pass the corresponding value of  ed1 and modify table iznew.
    eg
    loop at iznew.
    iznew-ed1 = ed1.
    modify iznew.
    endloop.

  • How  to expand rows in a table by calculated value of a field

    Hi,
    I'm trying to set the rows of an expandable table to follow the calculated value of a field.
    The calculated field comes from two date fields that calculate the number of days and I want my table/row to expand based on that number..
    Is is possible? Right now I have a button that does add an instance  "Admin_Use.Table3._Row1.addInstance(1);" but I want it to be triggered by the calculated field instead...
    Thank you so much!!!!

    Hi Niall,
    Thank you for your reply. I'm still a bit puzzled as right now I have this code in my calculate field (see below) under the calculated event and I'm not sure how to insert the code you sent me as I keep getting syntax errors. Any help will be greatly appreciated!!!
    if (HasValue(Nights.FirstNight) & HasValue(Nights.LastNight) ) then
        if (Date2Num(Nights.LastNight, "YYYY-MM-DD", "en_IE") >= Date2Num(Nights.FirstNight, "YYYY-MM-DD", "en_IE")) then
            $ = Date2Num(Nights.LastNight, "YYYY-MM-DD", "en_IE") - Date2Num(Nights.FirstNight, "YYYY-MM-DD", "en_IE") + 1
    else
            xfa.host.messageBox ("The first night cannot be after the last night", "Nights Covered", 0)
            Nights.LastNight.rawValue = null
    endif
    else
    endif

  • How to populate the calculated value into screen field.

    I am doing one enhancement in QM.I have added one custom screen to notification transaction ( QM01/QM02/QM03) transaction tab strip control using the enhancement QQMA0001.The Details of the calling and called screens as shown bellow
    The Calling screen: SAPLIQS0
    Screen Number: 7790
    Screen Area :USER0001
    Called Screen: SAPLXQQM
    Screen Number: 0101
    I have developed the Custom Screen in screen 0101 and called in PBO of program SAPLIQS0 7790 screen.
    The Screen in calling perfectly .The Custom screen having different fields like Raw cost, Intermediate cost, Finished cost, SCAR Cost and Sales Order Cost Etc... These fields are out put filed types. No input for these screens.. I have few doubts regarding this
    How to populate the calculated values in Custom screen?
    Where we wrote the code to populate the calculated values in custom screen?
    You have any idea please guide me
    Thanks & Regards,
    Samantula

    As your screen fields should be global variables in SAPLXQQM, you may initialize them by implementing function module EXIT_SAPMIWO0_008 which also belongs to SAPLXQQM (Customer Exit: Transfer Notification Data to User Screen)

  • Newbie Question:  How much computer do I need?

    Newbie Question:
    I would like to use MainStage 3 in a live performance environment to play bars, parties, etc.  I'm not looping, using it to playback recordings, processing outboard equipment or vocal processing.  I want to stop carrying Rolands, Nords, Korgs, etc and get to a controller and a rack with a Mac Mini in it.
    I tested a download of Mainstage 3 on my home Mac Mini (late 2012, 3.5 Ghz i5, 4GB RAM, 500GB drive) and it seemed to run fairly well.  $30 well invested so I trekked forward... I purchased a Mac Mini (late 2009,  2.52GHz Core 2 Duo, 6GB RAM, 128GB SSD) for $200.  I started to do more elaborate keyboard setups to see how the CPU would hold up.  It typically runs from 30% to 50% of capacity (CPU and Memory)  It actually boots and runs better than the i5.  I hear the occasion gitch, but it actually seems to be getting better in time (or I'm rock and roll deaf.
    I got a rack, an Airport Express, a Radial USB interface and a Nektar Panorama P6.  It's starting to get expensive, but I'm emboldened by the actual quality for the sound and the flexibility of arranging for live performance.  What used to take me two and three keyboards to play, I can now fit on one performance patch.
    OK, now the question... am I at the limits of this little Core 2 Duo?  Should I upgrade the i5 with more RAM and a bigger SSD and use that?  Should I get a new(er) i7 and bite the $1,500 bullet for the additional RAM and SSD?
    I see that most of you are running pretty nice Macbook Pros with i7 and lots of everything.  My needs are modest; am I OK? 
    BTW, I want to run a Mac Mini in a box because I don't want to carry a laptop out in the open.  If I was doing bigger shows I wouldn't care but I play some rowdy bars and constantly have folks hanging off me while I'm playing.  It's fun, but hard on gear.  If you can't drop it or dip it in beer, it won't last long where I work.
    Matt Donnelly

    Rule of thumb: newer and faster is better. But, depending the complexity of your needs you may be OK with an older Mac. Some glitches that happen in a live performance are due to loss of communication with USB or Firewire inputs, so make sure they're secure. I recently upgraded from a 2010 Mac Mini 2.6 dual core with 16 GB RAM, which was used live for nearly four years, to the latest Mac Mini 3.0 i7 with 16 GB RAM and a 500 GB SSD. I was getting an occasional stuck note with the older one. The new one is rock solid. Some of my patches may have up to a dozen channel strips mapped to three keyboards. The Mini is mounted in a rack next to a MOTU Ultralite Hybrid. It is a good idea to map a panic button on your keyboard to controller # 123(all notes off). Also, you might want to invest in a battery backup power supply(APC, Cyberpower, etc.-$40-$60) to protect your Mac against power loss, which can damage you hard drive.

  • Multiple version of JRE in company..How to manage? (newbie question)

    Greetings..this is a newbie question
    We have 48 versions of JRE running in on XP IE6 in our company.
    Some version beat up other JAVA applications.
    It's a mess.
    How can anyone manage this many versions?
    Can we consolidate down to a few versions?
    I saw some posts on changing the JRE dynamically or perhaps using a wrapper with a product from "sourceforge".
    Are these viable?
    Thanks in advance

    We have 48 versions of JRE running in on XP IE6 in
    our company.
    Some version beat up other JAVA applications.
    It's a mess.can you elaborate on how some versions "beat up" other apps?
    How can anyone manage this many versions?you don't, each computer should periodically upgrade (IMO) but you shouldn't care. if you do, tell your users to load the latest version
    Can we consolidate down to a few versions?sure
    I saw some posts on changing the JRE dynamically or
    perhaps using a wrapper with a product from
    "sourceforge".
    Are these viable?i have no idea what this is, but I have doubts about your problem, if it exists at all

  • Newbie Question. just installed IE7.. how do I set up a local host to preview sites?

    Sorry for the newbie question... but it's been a long time since I have done this
    Thanks!

    Just define your site in DW as always.  For a static site, that's all you need to do.

  • How to paste calculated values from Numbers?

    When I copy calculated values from Numbers and paste into a table in Pages, I get an image like the one below.  Non calculated values paste fine.
    To get around this issue, I paste the calculated values into TextWrangler, then copy from there and paste into Pages.  Is there a way to go directly from Numbers to Pages with calculated values?

    Hi 4th Space,
    I you are pasting into a table in Pages, follow Jeffs instructions.
    I you are not pasting into a table, this works. Copy the cells in Numbers. Go to your Pages document and under the Edit Menu > Paste and Match Style. It works like Paste Values.
    Ian.

  • Calculated value and color change

    I am a newbie desiging a form in Livecycle. 
    Have a table with some calculated fields - using formcalc. 
    I want to change the color of these fields based on the calculated value but I don't know how to have multiple events occurring in the one cell. 
    I can get it working if I put the color change script into the exit event of the cell but as it's a read only cell, the user will not be exiting the cell.  I have had no luck putting the color change script elsewhere.  Any help would be appreciated.

    Actually, in full screen mode the top is cut off! I never noticed that since I always use full screen. This only happens in ACR. All other screens are fully represented. I may cut back on the height adjustment and see if I can see the top. Thanks for pointing it out, Ramon.
    Back to the problem at hand, if you notice, all sliders are at -0-, and if you could look at all the adjustment panels, everything is neutral. So, what is it adjusting?
    If I open a RAW file I also get the triangle, but when it disappears only the slightest change is noticeable in the histogram, and nothing in the image itself. This is true even with the .nefs tweaked.
    Finally, the image 1 is correct with respect to the same file in PS. I compared the screen shot to the full image side by side, in PS. Image 2 is not. If I do a tweak in ACR then open in PS, it's not what I want to see.
    This particular frame is tagged with the ACR icon in Bridge, but I have other tiffs that are not, and the same thing occurs.
    FAPP, I cannot not color correct in ACR with a tiff. I do it as an .nef

  • IFS Newbie questions

    Two newbie questions:
    1. I have a simple batch file as below that I execute using ifsshell.
    login system/manager
    cd /FolderSystem
    put /usr/local/oracle/testifs/test.txt
    logout
    How do I copy to iFS all files in a specified local directory - /usr/local/oracle/testifs/* doesn't seem to work.
    2. Can database user be mapped to iFS user?
    Thanks in advance,
    Anandhi

    xsi wrote:
    - Is there a way to display X-Axis labels vertically in a chart?
    See Badunit's reply below.
    - Is there a way to display only specific values in a line chart?
    You can create a chart from "all the data in a table or only data in selected cells of one or more tables," according to the Numbers '09 Users Guide. Rather than reinvent the wheel, I'll refer you to Chapter 7 of that document, and specifically to Page 132.
    If I recall correctly, there is a copy of the Users Guide on the IWork installation disk. If not, the Guide is available for download in the Help menu in Numbers.
    Regards,
    Barry
    Message was edited by: Barry

  • Newbie Question about FM 8 and Acrobat Pro 9

    Hello:
    I have some dcouments that I've written in FM v8.0p277. I print them to PDF so that I can have a copy to include on a CD and I also print some hard copies.
    My newbie question is whether there is a way to create a  PDF for hard copy where I mainitain the colors in photos and figures but that the text that is hyperlinked doesn't appear as blue. I want to keep the links live within the soft copy. Is there something I can change within Frame or with Acrobat?
    TIA,
    Kimberly

    Kimberly,
    How comes the text is blue in the first place? I guess the cross-reference formats use some character format which makes them blue? There are many options:
    Temporarily change the color definition for the color used in the cross-reference format to black.
    Temporarily change the character format to not use that color.
    Temporarily change the cross-reference definition to not used that character format.
    Whichever method you choose, I would create a separate document with the changed format setting and import those format into your book, create the PDF and then import the same format from the official template.
    - Michael

  • Domain name settings - Newbie question

    Sorry for a newbie question!
    I am already pointing a domain name to web hosting for email account. Now, I need an application server to run ERP software and Oracle, and installing Solaris and Oracle need a domain name.
    If I point my domain name to the server, how do I receive emails from web hosting???
    Install an email server to the application server instead? What can I do if I want the same domain name? Any option?

    Setting up a mailserver and making sure it doesn't suddenly turn into a spambox is not something you do with the use of a few commands. I suggest to dive into the Solaris admin guide on docs.sun.com and read up on e-mail and network services.
    If that is asking too much of your time you'll be better off getting your ISP to handle all this for you.

  • Domain Name settings in Solaris - Newbie question

    Sorry for a newbie question!
    I am already pointing a domain name to web hosting for email account. Now, I need an application server to run ERP software and Oracle, and installing Solaris and Oracle need a domain name.
    If I point my domain name to the server, how do I receive emails from web hosting???
    Install an email server to the application server instead? What can I do if I want the same domain name?

    Your questions are completely off-topic for the forum.
    These SunOS forums are for questions on <i>"how do I install my OS"</i>
    You particular question is in the <i>"how can I install Solaris while using the CD drive"</i> forum.
    So, if you had a question on how to edit the /etc/inet/hosts file to establish a FQDN on the computer, then it might be appropriate for the forum.
    Unfortunately, I don't have a clue on where to redirect you, except perhaps to the Sun Java Enterprise System suite of applications?

  • Calculated value from multiple rows in selection set

    Consider this query
    SELECT WELL.UWI
    FROM geo_formation A, WELL
    WHERE ( (select min(top_depth)
    from geo_formation B
    where B.uwi = A.uwi
    and form_id = 'WDBD' )
    (select min(top_depth)
    from geo_formation C
    where C.uwi = A.uwi
    and form_id = 'VKNS' )
    ) > 10
    AND A.uwi = WELL.UWI
    AND A.FORM_ID IN ('WDBD','VKNS')
    ORDER BY WELL.UWI, A.FORM_ID
    The question asked by the query is
    Show me all the entities (entities are identified by WELL.UWI)
    where the distance between the geological formations (identified by WDBD and VKNS)
    is greater than 10
    The distance in question of course is calculated in the
    (select min(top_depth)
    from geo_formation B
    where B.uwi = A.uwi
    and form_id = 'WDBD' )
    (select min(top_depth)
    from geo_formation C
    where C.uwi = A.uwi
    and form_id = 'VKNS' )
    portion of the where clause.
    ** My question:
    Is there any way to get this calculated value to be part of the selection list
    ie.
    SELECT WELL.UWI, 'the calculated value in question'
    FROM geo_formation A, WELL ...

    Thanks Barbara; once again your solution to one of my problems works like a charm.
    On top of that, I learned something important; I did not know that one can essentially achieve the same results as creating a temporary table by including the appropriate (select ...) in the from clause.
    Thanks again.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Barbara Boehmer ([email protected]):
    SELECT a.uwi, (bmin - cmin) distance
    FROM well a,
    (SELECT uwi, MIN (top_depth) bmin
    FROM geo_formation
    WHERE form_id = 'WDBD'
    GROUP BY uwi) b,
    (SELECT uwi, MIN (top_depth) cmin
    FROM geo_formation
    WHERE form_id = 'VKNS'
    GROUP BY uwi) c
    WHERE b.uwi = a.uwi
    AND c.uwi = a.uwi
    AND bmin - cmin > 10
    ORDER BY a.uwi
    /<HR></BLOCKQUOTE>
    null

  • How to retrive question name in msg in procedure by writing custom coding

    how to retrive question name in message in procedure by writing custom coding.........

    My apologies if I've completely missed the boat on where you are going with this...but it seems to me that embedded values in action messages are meant for variable text. In other words, you reference the question variable you want, but it will pull the actual response each time the detail runs, e.g. \AETERM\ will return whatever that is each time the edit fires.
    If you are meaning to place non-variable text into an action message, generally, the fastest way to do this is to simply type it in. I'm sure there is custom code out there to do this, however, simply typing AETERM doesn't take very long--definitely not as long as developing custom code.
    Again, sorry if I've missed the point entirely.

Maybe you are looking for

  • Sap 6.0 features

    hi,   what are the new features in sap 6.0 than sap 5.0

  • Can anyone help with Dreamweaver CS6 crashing in Mavericks OS?

    Hi all, I've been going through all the discussions and performing all the steps that are in these forums about Dreamweaver crashing on launch, with no luck. I am using an iMac 2007, Mavericks OS and Dreamweaver is the only software in the Creative s

  • EXS24 Unusable in X - Can't find samples

    EXS24 keeps coming up with this error message when I try to load an instrument: Audio File 'xxx' not found, Search again, Ignore.. There is no option to find it manually so it's impossible to proceed.. I have both my Sample Instruments and Samples fo

  • Tree structure xtras and flash buttons

    im doing a prototype of small project in Director for an e-learning application. i need to build a tree like structure based menu with graphical icons as the main navigation method of the movie. there is a TreeView Xtra by broadband but it is too exp

  • BGP: Customer network announcing error (not advertised)

    Hi to all. Our company - is small business ISP. We have two BGP upstreams, and some customers who connect with us via BGP. Day ago, our customer opened a case that we don't announce his network to the "global network". I can see, that he announce me