VI to calculate partial derivatives and curvature on a surface
I have a surface (a series of x, y, z triple that form a grid, measures, not a formula). I want to calculate the curvature at each point of the grid. I already have a smoothing and interpolation, so it doesn't have really sharp edges. I understand that I can not calculate curvature to the edge because I need adjacent squares. Is there a routine LV integrated for this or should I write my own?
If I have to write my own routine, I'll write a nested loop that goes along each row and column of the grid. At each point, I'll estimate the matrix of 2nd partial derivatives by finite differences. Since I have will calculate the maximum curavature, or a minimum radius of curvature, at this time there (once I found the formula, which I have not quite finished).
I appreciate all the suggestions; I hope that there is already a VI to do. Thank you.
Hi, WCR.
For the calculation of the curvature, we only have a VI IMAQ called "IMAQ classify Curvature.vi" (http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_classify_curvature/) that will calculate the curvature for you. However, it is a function of the NOR-IMAQ driver, and it only accepts an image of contour. So if you don't plan to treat it with a photo, then you will have to calculate the minimum/maximum curvature with our artihmetic vi.
There is a VI that will compute the partial derivatives called "Derived partial of f (x 1, x 2) VI" (http://zone.ni.com/reference/en-XX/help/371361H-01/gmath/partial_derivatives_fx1x2/). It notably VI will calculate a 2D of two independent variables table.
I hope this helps!
Tags: NI Software
Similar Questions
-
Windows xp has been partially updated and may not work perfectly
To install the 3 XP SVC pack... Neede Svc Pak 2 do following error Yes, obtained by attempting to do so.
Windows XP has been partially updated and may not work perfectly
Hello
-You installed correctly updated recently?-You are aware of any changes made on the computer before this problem?Method 1: I suggest to maintain the computer in clean boot mode and check if the problem still persists.Step 1: Clean Boot Mode
A clean boot to check if startup item or services to third-party application is causing this issue.
You can read the following article to configure the computer to boot:
http://support.Microsoft.com/kb/929135
Note: After the troubleshooting steps, refer to clean the start link to configure the computer to normal startup mode.Step 2: Manually disable the AntivirusImportant note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.
Step 3: Install Service Pack 2 (SP2)Steps to take before you install Windows XP Service Pack 3Include to determine which SP1 is installedMethod 2: Follow the steps mentioned below and check if the problem persists.Step 1: Microsoft Windows Update Agent toolHow to get the latest version of the Windows Update Agent?Step 2: Try to install the updates and check if the problem persists.Method 3: Try to download and install the Windows XP SP2 and SP3 manually and check if the problem persists.For Windows XP SP2:Windows XP Service Pack 2 network installation Package for IT professionals and developersFor Windows XP SP3:Windows XP Service Pack 3 network installation Package for IT professionals and developersHope this information helps. -
How to calculate the second and minisecond for audio landmark
I'm doing a sound synchronization for the clip audio and video in Flash. I found a tutorial on the web, and it seems to work. However, I do not know how to calculate the second and the mini (deuxieme from mp3 file. The first frame has the following lines to set the duration for each animation:
Import class
Import net.quip.sound.SoundSync;
Stop the main timeline
Stop();
Create an instance of SoundSync
var ss:SoundSync = new SoundSync();
ss.addCuePoint ("IT", 20100);
ss.addCuePoint ("admin", 20000);
ss.addCuePoint ("maintenance", 19800);
ss.addCuePoint ("treatment", 16479);
ss.addCuePoint ("engineering", 14598);
as.addCuePoint ("logo_epa_npdes", 12356);
ss.addCuePoint ("construction", 8967);
ss.addCuePoint ("370 mg/j", 7896);
ss.addCuePoint ("mc_650, 000 ', 5439);
ss.addCuePoint ("130 mg/j", 3254);
ss.addCuePoint ("1938", 2439);
ss.addCuePoint ("vintage_mc", 0);
Use the instance of loading external MP3
ss.loadSound ("Scn04 - 05.mp3", true);
Create a listener object for the
cuePoint and onSoundComplete events
var listener: Object = new Object();
listener.cuePoint = function (): Void {}
Play();
}
listener.onSoundComplete = function (): Void {}
Play();
}
ss.addEventListener ("cuePoint", listener);
ss.addEventListener ("onSoundComplete", listener);
and the soundsync.as file as follows:
Import mx.events.EventDispatcher;
Import mx.utils.Delegate;
class net.quip.sound.SoundSync extends its {}
PROPERTIES
private var _cuePoints:Array;
private var _currentCuePoint:Number;
private var _interval:Number;
private var _intervalDuration:Number;
private var _secondOffset:Number;
Event dispatcher
public var dispatchEvent:Function;
public var addEventListener:Function;
private var removeEventListener:Function;
CONSTRUCTOR
public void SoundSync(target:MovieClip) {}
Super (target);
init();
}
METHODS
private function init (): Void {}
Initialize properties
_cuePoints = new Array();
_currentCuePoint = 0;
_intervalDuration = 200;
_secondOffset = 0;
Initialize the instance of the class as the valid event broadcaster
EventDispatcher.initialize (this);
}
Add Cue Point
public void addCuePoint(cuePointName:String,_cuePointTime:Number):Void {}
() _cuePoints.push
{
type: "cuePoint",.
name: cuePointName,.
time: cuePointTime,.
target: this
}
);
_cuePoints.sortOn ("time", Array.NUMERIC);
}
Get cue point
public void getCuePoint(nameOrTime:Object):Object {}
var counter: Number = 0;
While (counter < _cuePoints.length) {}
If (typeof (nameOrTime) == 'string') {}
If (_cuePoints [meter] .name == nameOrTime) {}
return _cuePoints [counter];
}
} Else if (typeof (nameOrTime) == 'number') {}
If (_cuePoints [meter] .time == nameOrTime) {}
return _cuePoints [counter];
}
}
counter ++;
}
Returns a null value.
}
Get the Index of the current Cue Point
private void getCurrentCuePointIndex(cuePoint:Object):Number {}
var counter: Number = 0;
While (counter < _cuePoints.length) {}
If (_cuePoints [meter] .name == cuePoint.name) {}
return the meter;
}
counter ++;
}
Returns a null value.
}
Get the next Cue Point index
private void getNextCuePointIndex(seconds:Number):Number {}
seconds (seconds) =? seconds: 0;
var counter: Number = 0;
While (counter < _cuePoints.length) {}
If (_cuePoints [meter] .time > = seconds * 1000) {}
return the meter;
}
counter ++;
}
Returns a null value.
}
Benchmark deleted
public void removeCuePoint(cuePoint:Object):Void {}
_cuePoints.splice (getCurrentCuePointIndex (cuePoint), 1);
}
Remove all Cue Points
public function removeAll_cuePoints (): Void {}
_cuePoints = new Array();
}
Beginning
public void start(secondOffset:Number,_loops:Number):Void {}
Super.Start (secondOffset, loops);
dispatchEvent ({type: "onStart", target: this});
Reset benchmark
_secondOffset = secondOffset;
_currentCuePoint = getNextCuePointIndex (secondOffset);
Poll for cue points
clearInterval (_interval);
_interval = setInterval (Delegate.create (this, pollCuePoints), _intervalDuration);
}
Load sound
public void loadSound(url:String,_isStreaming:Boolean):Void {}
super.loadSound (url, isStreaming);
clearInterval (_interval);
_interval = setInterval (Delegate.create (this, pollCuePoints), _intervalDuration);
}
Stop
public void stop(linkageID:String):Void {}
If {(linkageID)
Super.Stop (linkageID);
} else {}
Super.Stop ();
}
dispatchEvent ({type: "onStop", target: this});
Kill the ballot
clearInterval (_interval);
}
Survey benchmarks
private function pollCuePoints (): Void {}
If the current position is close to the cue point.
var time: Number = _cuePoints [_currentCuePoint] .time;
var span: Number = (_cuePoints [_currentCuePoint + 1] .time)? _cuePoints [_currentCuePoint + 1] .time: time + _intervalDuration * 2;
If (position > = time & & position < = span) {}
Send event
dispatchEvent (_cuePoints [_currentCuePoint]);
Advance to the next landmark...
If (_currentCuePoint < _cuePoints.length) {}
_currentCuePoint ++;
} else {}
_currentCuePoint = getNextCuePointIndex (_secondOffset);
}
}
}
EVENT HANDLERS
onSoundComplete
public function onSoundComplete (): Void {}
Kill the ballot
clearInterval (_interval);
Reset benchmark
_currentCuePoint = 0;
Send event
dispatchEvent ({type: "onSoundComplete", target: this});
}
}
any help will be greatly appreciated.Wuzhishan,
> Hi Dave, your tutorial is very cute and it is very useful.
Thank you! My daughter is cute. She inherited all of
me, so I have not left. ;)> I'm sorry that I don't have my question clearly.
No worries. :)
> I have listen mp3 in Windows Media Player and try to
> get both for the tail, I found it on the bottom of the
> player time indicates 00:26.I'm with you.
> How can I writer this number in the code? Is it 0026 or 26?
The code expects milliseconds, then 26 seconds would be written as
this:26000
If he said 01:22 (one minute and 22 seconds), you must write it like this:
82000
... which is 60 seconds for now, 22 seconds
side, then multiplied by 1,000 to get milliseconds.David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design." -
Send partial, immediate and life-cycle problem JSF
Hello
I have a form with a text entry field and a "submit" button. The attribute value of the input box (* private String name *)
is a property of support bean and it is bound to a property RichInputText *(private RichInputText nameField;) *.
in the same bean support. The Send button has an action listener that calls a method in my backing bean * (displayText (ActionEvent ae *))
). Button send the part delivery set to 'true' and immediate attribute set to 'true '. With the value 'true' my understanding is that life cycle jsf defines "apply request values" and then passes the validation, update of the model goes directly to invoke application phase. With this assumption, in call, setNameField (RichInputText name) will be called (apply request values) and I should be able to get the value using the method getLocalValue() on the RichInputText
class. But when I try to display in my managed bean, it is null.
How can I access the entry in my bean support value when both the partial shipment and immediate attruibtes are set to true on my "submit" button?
Here is my support bean class:
public class SampleBean {}
name of the RichInputText private field;
public SampleBean() {}
}
private String name;
public void setName (String name) {}
myIdName = name;
}
public String getName() {}
return the name.
}
{} public void setNameField (RichInputText name field)
this.nameField = field name;
}
public RichInputText getNameField() {}
return name field;
}
{} public void displayText (ActionEvent ae)
System.out.println (nameField.getLocalValue ());
System.out.println (Name);
}
}
JSF page:
& lt;? XML version = "1.0" encoding = "windows-1252'?" " & gt;
& lt; JSP:root xmlns:jsp = "http://java.sun.com/JSP/Page" version = "2.1".
xmlns:f = "http://java.sun.com/jsf/core".
xmlns:h = "http://java.sun.com/jsf/html".
xmlns:af = "http://xmlns.oracle.com/adf/faces/rich" & gt;
& lt; jsp:directive.page contentType = "text/html; charset = windows-1252 "/ & gt;
& lt; f: view & gt;
& lt; AF:document & gt;
& lt; AF:form & gt;
& lt; AF:inputText label = "Label 1" value = "#{sampleBean.name}".
Binding = "#{sampleBean.nameField}" / & gt;
& lt; AF:CommandButton text = "Submit" id = "submit" partialSubmit = "true".
immediate = "true".
actionListener = "#{sampleBean.displayText}" / & gt;
& lt; AF:outputText value = "#{sampleBean.name}" partialTriggers = "submit" / & gt; "
& lt; / af:form & gt;
& lt; / af:document & gt;
& lt; / f: view & gt;
& lt; / jsp:root & gt;
Hello
Well oops on my side. Yes, it the field isn't immediate value getSubmitted would not return a null value, but would be getLocalValue. There is an alternative if you do not use the trigger by calling processDecode (context) and processValidations (context) on the occurrence of input text before calling getLocalValue.
Kind regards
~ Simon
-
I saw this problem before on another computer. The Roboform toolbar partially blocks the Google toolbar search suggestions. I think the fix that worked once was to reorganize and force the Google toolbar to load last in Firefox in the about.config settings. How is it that I forgot?
This has happened
Each time Firefox opened
Is unknown on his computer.
Thanks for the replies. I'll try to get out them, but I think also there is a difficulty which worked via about: config that forced the order in which loading toolbars.
Anyway, thanks and I'll try that tonight.
-
With the mouse to draw the edges of a XY Chart to calculate the perimeter and area of him
I have signals from a stabilometer... I traced X in terms of y in a XY Chart and I want to know how I can draw with the mouse a circle linking most of the points that is the graph of X on Y and calculate the area of her more perimeter. I joined my program labview with two files X and Y
LV 2009 Version attached.
-
Partial goal and partial release takes so long
Hello.
Here's my situation:
I'm a jsff to sell products.
I designed it with several images representing products. Each image is surrounded by a command link.
Whenever I click on the image I need to combine the value and display the output in a text.
My problem is that the action is taking so long. So, if as a customer, I need to buy 3 x product, I need the clock in the image (CommandLink) three times.
I add a partial trigger component, alternative, I've added a partial objective to add the partial trigger by program, but in the two options takes a while.
Did I do something wrong?
Another option to make is there of that?
Thanks in advance.
You are absolutely sure that the partial call target taking so long?
I have my doubts on this assessment.
-
When I imported the photos from my hard drive some only partially loaded with only half of the growth of the photo?
Go to the Lightroom preferences > performance > uncheck 'use the graphics processor' > import images and test them.
-
I have upgraded to PSE13 and want to unistall PSE9. When I try to do it all I get is an error message "Error 1316. The specified account already exists. " Uninstaller restores then I'm left with a partially uninstalled version is unusable. I tried to reinstall the software from the original disc of PSE9 but everything he tries to do is to uninstall the version already on my computer and then did it, the same thing as above. How to completely uninstall PSE9?
See here:
-
Calculate intermediate values and calculated values
I use OPA for a week or two and now understand how to structure evaluations logics, hierarchies, etc.
Now, as the calculations become more complex, I was wondering if it is possible to calculate the variables to be used in further calculations.
A good example may be I want to calculate the age of the subject for use in several calculations later in the logic. I have an incoming parameter that provides the subject of birth date - can I somehow fill a variable like "age of the subject = the number of years between the date of the topic of birth and the date of the day? "I want to fill ' age of the subject ' with a number instead of evaluate what true or false - is it possible?
The second part of the question, it is that I want the web service to return "the age of the subject" as the parameter value.
Thank you!
In Oracle Policy Modeling, 'attributes', the 'entities' and the 'relationships' are the terms that you will be interested. Attributes can be Boolean, or can be a value of various types of data. Consult the help for your version and search attributes, entities and relationships. A base attribute such as 'age in years' value can be calculated from other attributes such as "the data of birth of the person." An attribute that is provided as input via an external system or via an interactive interview is also called a base level attribute, while a determined political base don attribute can be an intermediate attribute (both determined and used as a condition to determine another attribute), or call a top-level attribute (determine on the basis of politics) (, but not used as a condition). The aid also includes examples of policies that are used to calculate the values of attributes.
-
Calculate the start and end date in Connect By - during Hirerchy changes
/ * Formatted 05/20/2013 09:53 (PS5 v5.115.810.9015) * /.
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
Hello, can you please help me or guide me in the calculation of the dates of beginning and end to the underside of logic
I want to calculate the Hirerchy Manager to the Agent.
Then under query works fine and its giving me the expected results
But when there is a change in the Hirerchy Manager or manager gets promoted
Then I need to calculate the start date and end date.
CREATE TABLE PERSON_DTL ( SID VARCHAR2(10 BYTE), EMP_MGRS_ID VARCHAR2(10 BYTE), START_EFFECTIVE_DT DATE, END_EFFECTIVE_DT DATE ); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M100', 'M107', TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M101', 'M102', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('A100', 'M100', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M100', 'M101', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M107', 'M102', TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M102', 'M103', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M103', 'M104', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('A101', 'M105', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into PERSON_DTL (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT) Values ('M105', 'M106', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); COMMIT;
SELECT CONNECT_BY_ROOT (b.sid) agent_sid, TRIM ( LEADING ',' FROM SYS_CONNECT_BY_PATH (b.sid, ',') || ',' || b.emp_mgrs_id ) PATH, START_EFFECTIVE_DT Start_dt, END_EFFECTIVE_DT End_dt FROM PERSON_DTL b WHERE CONNECT_BY_ISLEAF = 1 START WITH sid IN ('A101', 'A100') CONNECT BY PRIOR b.emp_mgrs_id = b.sid
This is the results that i am getting now. AGENT_SID PATH START_DT END_DT A100 A100,M100,M101,M102,M103,M104 1/1/2010 12/31/9999 A100 A100,M100,M107,M102,M103,M104 1/1/2010 12/31/9999 A101 A101,M105,M106 1/1/2010 12/31/9999
Results Required A100 A100,M100,M101,M102,M103,M104 1/1/2010 5/18/2013 A100 A100,M100,M107,M102,M103,M104 5/20/2013 12/31/9999 A101 A101,M105,M106 1/1/2010 12/31/9999
WITH the CLAUSE will make it readable
SQL> with paths as 2 ( 3 SELECT CONNECT_BY_ROOT (b.sid) agent_sid, 4 TRIM ( 5 LEADING ',' FROM SYS_CONNECT_BY_PATH (b.sid, ',') 6 || ',' 7 || b.emp_mgrs_id 8 ) 9 PATH, 10 START_EFFECTIVE_DT Start_dt, 11 END_EFFECTIVE_DT End_dt,rownum rn 12 FROM PERSON_DTL b 13 START WITH sid IN ('A101', 'A100') 14 CONNECT BY PRIOR b.emp_mgrs_id = b.sid 15 ), 16 flagged as 17 ( 18 select agent_sid, 19 path, 20 start_dt, 21 end_dt,rn, 22 case when path like lag(path) over(order by rn)||'%' then 0 else 1 end flg 23 from paths 24 ), 25 summed as 26 ( 27 select agent_sid,path,start_dt,end_dt, 28 sum(flg) over(order by rn) sm 29 from flagged 30 ) 31 select agent_sid,max(path) path,max(start_dt) start_dt, 32 min(end_dt) end_dt 33 from summed 34 group by agent_sid,sm 35 order by agent_sid; AGENT_SID PATH START_DT END_DT ---------- ---------------------------------------- --------- --------- A100 A100,M100,M101,M102,M103,M104 01-JAN-10 18-MAY-13 A100 A100,M100,M107,M102,M103,M104 20-MAY-13 31-DEC-99 A101 A101,M105,M106 01-JAN-10 31-DEC-99
-
Partial update and dimension values
Hello
A question about partial and analytical, updates the documentation is not clear (perhaps because of my Dutch interpretation :-)).
We have a dimension called 'platform' that is autogen. 2 new platforms (Wii you) and XBox 720 will soon be available. These values will be displayed when we use partial updates?
Thank you
MaartenMaarten - if you introduce these two values in the files passed to partial updates, they become available, if this update succeeds.
-
Need help to calculate the start and end time and place the result in a term like text box
I did a search on the forum for calculating start and end time and found the code depending on which I am using as a formcalc on the duration field.
==============================================================
Form1. Page1.duration::calculate - (FormCalc, client)
If (HasValue (StartTime) and HasValue (EndTime)) then
industrial var = Time2Num (StartTime.formattedValue, "h: mm A")
var = Time2Num out_ (EndTime.formattedValue, "h: mm A")
If (IN2 > = out_) then
xfa.host.messageBox ("start time cannot be greater than or equal to the end time.")
$.rawValue = null
on the other
var out_ - IN2 = diff
$.rawValue = diff/3600000
endif
on the other
$.rawValue = null
endif
=============================================================
Then, when I enter for example from 15:30, an hour of beginning and end of 04:00
The duration field will say 0.5
How can I get my form to say 30 minutes instead of placing a decimal?
Secondly, how can I use field models LC where the employee can just type 330 or 03:30 and it automatically based on the computer's clock on time to start 15:30?
Any help will be greatly appreciated. Thank you.Attached is the form for display:
https://Acrobat.com/#d=f1kxh5qjuow5ujyZduF8OQ
To view the results in a regular time format, you can use:
$.rawValue = Num2Time (diff/3600000, "HH: mm")
For a flexible time entry check this example.
http://thelivecycle.blogspot.com/2011/05/flexible-Eingabe-von-Daten-und-Zeiten.html
-
calculate adding them and subtracting to the same cell?
I created a table that has fields of digital type in them. I'm trying to calculate it from two fields and generate the result in a cell. for example, the first cell of the column begins with count quantity, second cell of the column is of type number of quantity to remove from the beginning and cell of the third column to add to the beginning cell. the calculation must be filled in the fourth cell of the column. I am able to create calculation script adds fourth cell by adding just - Sum (begin1 + add1) - but can not understand subtract in the same field.
Form1.Page1.Subform1.table.row [0]. total::calculate - (FormCalc, client)
$.rawValue = a + b - c
-
query to calculate the value and produce new lines
QUARTER CUSTOMER PRODUCT RETAIL_SALES_AMT WHOLESALE_AMT
01/01/2006 ABC VACUUM CLEANER 454234,00 65633456.00
01/04/2006 ABC VACUUM CLEANER 324562,00 45333234.00
01/07/2006 ABC VACUUM CLEANER 67845423.00 NULL
01/10/2006 ABC VACUUM CLEANER 67453453.00 NULL
01/01/2007 ABC VACUUM CLEANER 56754633.00 NULL
01/04/2007 ABC VACUUM CLEANER 45423434.00 NULL
Hi guys,.
It's a situation where I have to produce a few new lines with projections based on Q4 RETAIL_SALES_AMT
RETAIL_SALES_AMOUNT and fourth ' rs following WHOLESALE_AMT. As you can see from the sample data for a specific customer,
product I have populated only until 01/04/2006 retail_sales_amt but WHOLE_SALE amt for the same product and customer
are there up to 01/04/2007.
I have to produce a PROJECTED RETAIL_SALES_AMT and it must be inserted in a new line with an indicator to identify
a proposed line. Here, in this case I have to produce a new line of projection from 07/01/2006,10/01/2006 and 01/01/2007
the RETAIL_SALES_AMT. The method of calculation is provided for in:
retail_sales_amt scheduled for 07/01/2006=.345+ ((01/07/2006 whole_sales-01/04/2006 whole_sales) / (01/04/2006 whole_sale)))
* 01/04/2006 RETAIL_SALES_AMT and move forward to subsequent quarters.
Is it possible that I can use a query to produce these new lines by calculating the RETAIL_SALES_AMT on the fly, or any other
How to procedure.
Please help as it seems a little complicated.
Concerning
Published by: user626688 on October 27, 2009 11:26
Published by: user626688 on October 27, 2009 11:26
Published by: user626688 on October 27, 2009 11:27
Published by: user626688 on October 27, 2009 11:28
Published by: user626688 on October 27, 2009 11:31
Published by: user626688 on October 27, 2009 11:32Hello
As far as I can tell, that's what you asked for:
WITH got_prev AS ( SELECT table_x.* , LAG (wholesale_amt) OVER ( PARTITION BY customer , product ORDER BY quarter ) AS prev_wholesale_amt FROM table_x -- WHERE ... -- Any filtering goes here ) , tree AS ( SELECT got_prev.* , SYS_CONNECT_BY_PATH ( CASE WHEN LEVEL = 1 THEN retail_sales_amt ELSE ( .345 + wholesale_amt - prev_wholesale_amt ) / prev_wholesale_amt END , '*' ) AS path FROM got_prev START WITH retail_sales_amt IS NOT NULL CONNECT BY retail_sales_amt IS NULL AND quarter = ADD_MONTHS (PRIOR quarter, 3) AND customer = PRIOR customer AND product = PRIOR product ) SELECT quarter , customer , product , COALESCE ( retail_sales_amt , eval_number ( LTRIM ( path , '*' ) ) ) AS retail_sales_amt , wholesale_amt , NVL2 ( retail_sales_amt , 'F' , 'T' ) AS projected_flag FROM tree ORDER BY customer , product , quarter ;
I posted earlier the eval_number function.
In this query, a group of consecutive quarters, where the first group a retail_sales_num and the rest of the members of the group are not, is treated as a hierarchy. The retail_sales_amt of all members (except the first) will be based on the previous, as well as the wholesale_amts past and present.
Say that a tree is 5 points of time (as in your examples of data). We can calculate the 2nd point in several ways: using analytical functions, for example. But we cannot use the same formula to calculate the 3rd point, because the calculation of section 2 must be completed before we can calculate the 3rd. It goes the same for the 4th and 5th.
This is CONNECT BY arrives. CONNECT BY is one thing in Oracle SQL that can be recursively; children may find themselves once their parents are found, in the same way we want to calculate the nth retail_sales_amt once the amount of the n-minus-1 has been calculated. To do this, we use SYS_CONNECT_BY_PATH, where the first element in the path is the retail_sales_amt given, and all others are the factor to multiply this number to get the next amount.
SYS_CONNECT_BY_PATH produces a string like ' * 324562 *. 4965935 *-. 0057739', which should be interpreted as a number. TO_NUMBER won't: TO_NUMBER cannot convert only a single numeric literal. Instead, we have a function defined by the user who put this string dynamically in the SELECT clause of a query, where it is interpreted as a numeric expression.
Maybe you are looking for
-
VNC Mac does not not after security update 2016-002
After the 2016 002 security update, I am unable to VNC into any Mac Machine that has been updated. Error: The account you selected is not available
-
Defines a point in a discreet XY Chart. (Correction curve)
I have an XY graph, which consists of discrete points. As X Y 100 1.2 150 2.3 200 1.5 2 250 300 1.8 This is usually used as a correction curve, which shows a tendency to a value of Y for a specific X. OK, I have an X, but not in the XY graph p
-
E-mail troubleshooting outlook express
Won't receive e-mail. Request name and password. I do not have
-
Scan pictures into my a6683w HP Vista in black and white, but the documents still scan in color.
-
I should be enjoying my XOOM!
Has anyone developed calluses on their index fingers? :-))))