Need a loop
What kind of loop syntax can be added to...
SELECT TRUNC(SYSDATE) dt FROM dual
... such that it returns all dates between 3/1/2007 and SYSDATE?
well, perhaps Tom was trying to "dumb it down" for other people. I really find it hard to accept that Tom believes in magic in an oracle database. Perhaps Tom was busy those days, and had ghost writers?
I don't see the humor in dual that Jonathan does, howver I will agree that it is "special" and an "irritant". special in that you assume there is only one row, and as such, can write code to rely on that, and you ignore the "full" scans in explain plans. An irritant in that you assume it has one row, and then some knucklehead runs a catalog script by mistake, adding a second row to it, and things no longer work as expected; plus some blowhard is always complaining about the full scan from dual.
Chuck? Hmmm, well, he's a special, magical case, isn't he. I'd give more credence to that quote if I could find it published by oracle (instead of on random blogs and forums). But, for the sake of argument, I'll assume it's true (but if you have a link to it from oracle, I would appreciate it). Regardless of his intentions, the table has existed as a normal, regular, accessible table since at least v5 (that's when I started using oracle, and dual was there then). and even today, in my 10g database, dual is no different than any other table - just check dba_tables.
the only distinction to be made is the distinction between data, not tables. if you know that a table has one row, you can use it without worrying about extra where, connect by, or group clauses. dual works the same as any other table:
select dummy, level
from dual
connect by level < 5
and prior dummy=dummy
and prior dbms_random.value is not null;
D LEVEL
X 1
X 2
X 3
X 4so, the solution that I gave (the one that nobody ever asked for, even though it was the one they wanted all along) works the same for DUAL and for EMPLOYEE. but since the DATA in dual is different than the DATA in employee, you can write a shorter statement when using dual. is that really magic? no, it's just the laws and rules of sql.
and I never accused the OP of saying dual is "imaginary" (although I chuckled when I read it from you). I'm simply trying to straighten him out, and get him to understand that dual is no different than any other table with one column and one row. that's for his benefit going forward. he'll write much better code if he actually understands what he's doing.
and the OP did make a blanket statement that "connect by level" does not work on other tables. but it does. like everything in oracle, it just needs to be done correctly. however, I give the OP credit for retracting his statement after he was corrected - "without sufficient syntax to avoid what happened". as I stated, because the data in dual is different than the data in other tables, the "sufficient" sql is different.
defensive, no. just stating the facts for the edification of the OP, and anyone else reading this thread.
rude, maybe. depends on how overly sensitive you are.
Similar Messages
-
Hi guys,
I have a movie player that uses custom code instead of
components and all is well. But now I need to loop the videos
instead of just having them play through and stop. Does anyone have
a block of code that will pull that off?
My current code is attached.
Thanks!Here's a bunch of custom video controller code. You can
probably get something from it:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.setBufferTime(30);
ns.onStatus = function(info) {
//trace(info.code);
if(info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
if(info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
//if(info.code == "NetStream.Play.Stop") {
//ns.seek(0);
ns.play(vidPath);
//ns.play("
http://www.portfolionewengland.com/interviews/rKukalis150.flv");
playButton.onRelease = function() {
ns.pause();
rewindButton.onRelease = function() {
ns.seek(0);
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 208.9;
loader.scrub._x = ns.time / duration * 208.9;
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,208,this._y);
loader.scrub.onRelease = loader.scrub.onReleaseOutside =
function() {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/208)*duration));
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
var item1:ContextMenuItem = new ContextMenuItem("::::: Video
Controls :::::",trace);
theMenu.customItems[0] = item1;
var item2:ContextMenuItem = new ContextMenuItem("Play / Pause
Video",pauseIt,true);
theMenu.customItems[1] = item2;
var item3:ContextMenuItem = new ContextMenuItem("Replay the
Video",restartIt);
theMenu.customItems[2] = item3;
var item4:ContextMenuItem = new ContextMenuItem("© 2005
Lee Brimelow",trace,true);
theMenu.customItems[3] = item4;
function pauseIt() {
ns.pause();
function stopIt() {
ns.seek(0);
ns.pause();
function restartIt() {
ns.seek(0);
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute.onRollOver = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("onOver");
else {
this.gotoAndStop("muteOver");
mute.onRollOut = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("on");
else {
this.gotoAndStop("mute");
mute.onRelease = function() {
if(so.getVolume()== 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
else {
so.setVolume(100);
this.gotoAndStop("onOver");
stop(); -
I need help writing a excelmacro to do a copy of 4 cells and paste transpose. I need to loop the copy and paste through 6900 rows of data. I started the macro with two rounds of copying & paster transposed but I need help getting it
to loop through all rows. Here is what macro looks like now.
Range("I2:I5").Select
Application.CutCopyMode = False
Selection.Copy
Range("J2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("I6:I9").Select
Application.CutCopyMode = False
Selection.Copy
Range("J6").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End SubThanks Jim for the solution above.
Hi Brogents,
Thanks for posting in our forum. Please note that this forum focuses on questions and feedback for Microsoft Office client. For any
VBA/Macro related issues, I would suggest you to post in the forum of
Excel for Developers, where you can get more experienced responses:
https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Ethan Hua
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Hello, I need to loop a 0 0 2 0 length region every 0 1 0 0 interval. Is there an easy way to do this without adding silence to the region to match the region length to my loop length?
I found a way by packing the region into a folder, setting the folder length, then looping. This works, but just seems like a lot of unnecessary steps....
-
Hi,
I have been tasked with writing an Oracle Function to query a set of tables to locate data that best matches what a user needs.
If data is not returned in a given query, we need the procedure to loop and run a modified query. If that query does not give data, we continue to loop and refine until we reach a point where we have expended all of our filtering levels.
I am new to writing PL SQL and have been doing a lot of googling trying to figure out how to do this, but I am stuck :(
I have not been able to figure out how to continue looping in the Procedure when there are no results in the record set.
It is probably something simple, I just haven't been able to figure it out.
HERE'S WHAT SEEMS TO BE THE PERTINENT PART OF THE CODE:
OPEN v_cursor FOR v_sql;
DBMS_OUTPUT.PUT_LINE(v_sql);
--THIS IS THE PORTION I AM HAVING PROBLEMS WITH:
--If there are results I want to set the following
--haveResultsOrAllQueriesDone := TRUE;
--Otherwise, I want to leave haveResultsOrAllQueriesDone := FALSE; and continue to loop
RETURN v_cursor;
END LOOP;
Thanks in advance for any direction any one can give me.
Thanks!
:) Anne
PS:
HERE IS THE COMPLETE FUNCTION AS I HAVE IT SO FAR:
create or replace
FUNCTION LOCATEACONSULTANT_function
p_action IN VARCHAR2,
p_first_name IN VARCHAR2,
p_last_name IN VARCHAR2,
p_exact_match IN VARCHAR2,
p_country_code IN VARCHAR2,
p_state IN VARCHAR2,
p_city IN VARCHAR2,
p_zip_or_postalcode IN VARCHAR2,
p_language_code IN VARCHAR2)
RETURN types.ref_cursor
AS
v_cursor types.ref_cursor;
v_temp_cursor types.ref_cursor;
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
DECLARE
type ref_cursor
IS
REF
CURSOR;
cursor_locateAConsultant ref_cursor;
v_select VARCHAR2(3000);
v_from VARCHAR2(2000);
v_where VARCHAR2(4000);
v_sql VARCHAR2(4000);
stateMapped ref_zip_mappings.state%type;
countyMapped ref_zip_mappings.county%type;
cityMapped ref_zip_mappings.city%type;
haveQueriedLanguage BOOLEAN := FALSE;
haveQueriedZip BOOLEAN := FALSE;
haveQueriedCity BOOLEAN := FALSE;
haveQueriedCounty BOOLEAN := FALSE;
haveQueriedState BOOLEAN := FALSE;
haveResultsOrAllQueriesDone BOOLEAN := FALSE;
haveDoneAllQueries BOOLEAN := FALSE;
tempLikeZip VARCHAR2(100);
BEGIN
v_select := 'SELECT customers.customer_id, customers.last_name, customers.first_name, ';
v_select := v_select || ' customer_contacts.email_address, addresses.state, addresses.city, ';
v_select := v_select || ' customer_contacts.web_site, customer_languages.language_code, customer_titles.pqv ';
v_from := ' FROM customers, customer_addresses, addresses, customer_contacts, customer_titles, customer_languages';
v_where := ' WHERE customers.customer_id = customer_addresses.customer_id ';
v_where := v_where || ' AND customer_addresses.address_id = addresses.address_id ';
v_where := v_where || ' AND customers.customer_id = customer_contacts.customer_id ';
v_where := v_where || ' AND customers.customer_id = customer_titles.customer_id ';
v_where := v_where || ' AND customers.preferred_language_code = customer_languages.language_code ';
v_where := v_where || ' AND UPPER(addresses.country_code) = UPPER(''' || p_country_code || ''') ';
v_where := v_where || ' AND UPPER(customers.exclude_locate) = '||''''||'N'||''''||'';
v_where := v_where || ' AND UPPER(customer_titles.customer_type) = '||''''||'CON'||''''||'';
v_where := v_where || ' AND UPPER(customer_titles.dp_id) LIKE '||''''||'CN%'||''''||'';
-- Line below assumes that 1 is the billing_address_type
v_where := v_where || ' AND customer_addresses.address_type_code = 1 ';
v_where := v_where || ' AND ';
v_where := v_where || ' ( ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MYARBONNE.COM%'||''''||' ';
v_where := v_where || ' OR ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MYARBONNE.COM.AU%'||''''||' ';
v_where := v_where || ' OR ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MYARBONNE.CA%'||''''||' ';
v_where := v_where || ' OR ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MYARBONNE.UK%'||''''||' ';
v_where := v_where || ' ) ';
IF (UPPER(p_action) =UPPER('search')) THEN
v_where := v_where || ' AND UPPER(addresses.state) = UPPER(trim(''' || p_state || ''')) ';
IF UPPER(p_exact_match) = UPPER('y') THEN
v_where := v_where || ' AND UPPER(customers.first_name) = UPPER(trim(''' || p_first_name || ''')) ';
ELSE
v_where := v_where || ' AND UPPER(SOUNDEX(customers.first_name)) = UPPER(SOUNDEX(trim(''' || p_first_name || '''))) ';
END IF;
IF UPPER(p_last_name) <> '' THEN
IF UPPER(p_exact_match) = UPPER('y') THEN
v_where := v_where || ' AND UPPER(customers.last_name) = UPPER(trim(''' || p_last_name || ''')) ';
ELSE
v_where := v_where || ' AND UPPER(SOUNDEX(customers.last_name)) = UPPER(SOUNDEX(trim(''' || p_last_name || ''')) ';
END IF;
END IF;
IF UPPER(p_city) <> '' THEN
v_where := v_where || ' AND UPPER(addresses.city) = UPPER(''' || p_city || ''') ';
END IF;
IF UPPER(p_zip_or_postalcode) <> '' THEN
v_where := v_where || ' AND UPPER(addresses.zip_or_postalcode) = UPPER(''' || p_zip_or_postalcode || ''') ';
END IF;
END IF;
WHILE (haveResultsOrAllQueriesDone = FALSE)
LOOP
IF (p_action = 'locate') THEN
IF (haveQueriedLanguage = FALSE) THEN
IF (p_language_code <> '') THEN
v_where := v_where|| ' AND UPPER(customer_languages.language_code) = UPPER(''' || p_language_code || ''') ';
haveQueriedLanguage := TRUE;
END IF;
--ELSE
-- haveQueriedLanguage := FALSE;
END IF;
IF (haveQueriedZip = FALSE) THEN
v_where := v_where|| ' AND UPPER(addresses.zip_or_postalcode) = UPPER(''' || p_zip_or_postalcode || ''') ';
IF (haveQueriedLanguage = FALSE) THEN
haveQueriedZip := TRUE;
END IF;
ELSIF (haveQueriedCity = FALSE) THEN
IF (p_city <> '') THEN
v_where := v_where|| ' AND UPPER(addresses.city) = UPPER('||''''|| p_city ||''''||') ' ;
ELSE
IF (p_country_code = 'UK') THEN
tempLikeZip := SUBSTR(p_zip_or_postalcode,( LENGTH(TRIM(p_zip_or_postalcode)) - 2 ));
v_where := v_where || ' AND UPPER(addresses.zip_or_postalcode) LIKE UPPER(TRIM('||'''%'||tempLikeZip ||''''||')) ' ;
ELSE
OPEN cursor_locateAConsultant FOR 'SELECT city FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER(TRIM('||''''|| p_zip_or_postalcode ||''''||')) ' ;
-- OPEN v_temp_cursor FOR 'SELECT city FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER(TRIM('||''''|| p_zip_or_postalcode ||''''||')) ' ;
LOOP
FETCH cursor_locateAConsultant INTO cityMapped;
EXIT
WHEN cursor_locateAConsultant%NOTFOUND;
END LOOP;
CLOSE cursor_locateAConsultant;
-- RETURN v_temp_cursor;
v_where := v_where || ' AND UPPER(addresses.city) = UPPER('||''''|| cityMapped ||''''||') ' ;
END IF;
END IF;
haveQueriedCity := TRUE;
ELSIF haveQueriedCounty = FALSE THEN
IF (p_country_code = 'UK') THEN
tempLikeZip := UPPER(SUBSTR(p_zip_or_postalcode,( LENGTH(TRIM(p_zip_or_postalcode)) - 3 )));
v_where := v_where|| ' AND UPPER(addresses.zip_or_postalcode) LIKE '||'''%'||tempLikeZip ||''''||' ' ;
ELSE
OPEN cursor_locateAConsultant FOR 'SELECT county FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER('||''''|| p_zip_or_postalcode ||''''||') ' ;
LOOP
FETCH cursor_locateAConsultant INTO countyMapped;
EXIT
WHEN cursor_locateAConsultant%NOTFOUND;
END LOOP;
CLOSE cursor_locateAConsultant;
v_where := v_where|| ' AND UPPER(addresses.county) = UPPER('||''''|| countyMapped ||''''||') ' ;
END IF;
haveQueriedCounty := TRUE;
END IF;
ELSIF haveQueriedState = FALSE THEN
IF (p_state <> '') THEN
v_where := v_where|| ' AND UPPER(addresses.state) = UPPER('||''''|| p_state ||''''||') ' ;
ELSE
IF (p_country_code = 'UK') THEN
tempLikeZip := UPPER(SUBSTR(p_zip_or_postalcode,( LENGTH(TRIM(p_zip_or_postalcode)) - 4 )));
v_where := v_where|| ' AND UPPER(addresses.zip_or_postalcode) LIKE '||'''%'||tempLikeZip ||''''||' ' ;
ELSE
OPEN cursor_locateAConsultant FOR 'SELECT state FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER('||''''|| p_zip_or_postalcode ||''''||') ' ;
LOOP
FETCH cursor_locateAConsultant INTO stateMapped;
EXIT WHEN cursor_locateAConsultant%NOTFOUND;
END LOOP;
CLOSE cursor_locateAConsultant;
v_where := v_where|| ' AND UPPER(addresses.state) = UPPER('||''''|| stateMapped ||''''||') ' ;
END IF;
haveQueriedState := TRUE;
END IF;
END IF;
v_sql := v_select || v_from || v_where;
OPEN v_cursor FOR v_sql;
DBMS_OUTPUT.PUT_LINE(v_sql);
--THIS IS THE PORTION I AM HAVING PROBLEMS WITH:
--If there are results I want to set the following
--haveResultsOrAllQueriesDone := TRUE;
--Otherwise, I want to leave haveResultsOrAllQueriesDone := FALSE; and continue to loop
RETURN v_cursor;
END LOOP;
END;
END;Thank you so very much for your kindness in answering my question.
Your suggestion helped.
We will be accessing this Procedure from a Java Class... I'm not sure how... but I know it is possible and probably not hard... If any one has suggestions, that would be helpful, but I am not concerned about that right now, as I think it should be straight forward... Hopefully I'm right :)
Thank you again!
Anne
Here's the code... which works, though may still need some more fine tuning:
create or replace
FUNCTION LOCATEACONSULTANT_function
p_action IN VARCHAR2,
p_first_name IN VARCHAR2,
p_last_name IN VARCHAR2,
p_exact_match IN VARCHAR2,
p_country_code IN VARCHAR2,
p_state IN VARCHAR2,
p_city IN VARCHAR2,
p_zip_or_postalcode IN VARCHAR2,
p_language_code IN VARCHAR2)
RETURN types.ref_cursor
AS
v_cursor types.ref_cursor;
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
DECLARE
type ref_cursor
IS
REF
CURSOR;
cursor_locateAConsultant types.ref_cursor;
v_select VARCHAR2(3000);
v_from VARCHAR2(2000);
v_where VARCHAR2(4000);
v_where_filter VARCHAR2(4000);
v_sql VARCHAR2(4000);
v_select1 VARCHAR2(4000):= 'SELECT 1 ';
v_temp VARCHAR2(1000);
stateMapped ref_zip_mappings.state%type;
countyMapped ref_zip_mappings.county%type;
cityMapped ref_zip_mappings.city%type;
v_hasRecords NUMBER := 0;
haveQueriedLanguage BOOLEAN := FALSE;
haveQueriedZip BOOLEAN := FALSE;
haveQueriedCity BOOLEAN := FALSE;
haveQueriedCounty BOOLEAN := FALSE;
haveQueriedState BOOLEAN := FALSE;
haveResultsOrAllQueriesDone BOOLEAN := FALSE;
haveDoneAllQueries BOOLEAN := FALSE;
tempLikeZip VARCHAR2(100);
BEGIN
v_select := 'SELECT customers.customer_id, customers.first_name, customers.last_name, ';
v_select := v_select || ' addresses.country_code, addresses.state, addresses.city, ';
v_select := v_select || ' addresses.zip_or_postalcode, customer_contacts.email_address, ';
v_select := v_select || ' customer_contacts.web_site, customer_languages.language_code';
v_from := ' FROM customers, customer_addresses, addresses, customer_contacts, customer_titles, customer_languages';
v_where := ' WHERE customers.customer_id = customer_addresses.customer_id ';
v_where := v_where || ' AND customer_addresses.address_id = addresses.address_id ';
v_where := v_where || ' AND customers.customer_id = customer_contacts.customer_id ';
v_where := v_where || ' AND customers.customer_id = customer_titles.customer_id ';
v_where := v_where || ' AND customers.preferred_language_code = customer_languages.language_code ';
v_where := v_where || ' AND UPPER(addresses.country_code) = UPPER(''' || p_country_code || ''') ';
v_where := v_where || ' AND UPPER(customers.exclude_locate) = '||''''||'N'||''''||'';
v_where := v_where || ' AND UPPER(customer_titles.customer_type) = '||''''||'CON'||''''||'';
v_where := v_where || ' AND UPPER(customer_titles.dp_id) LIKE '||''''||'CN%'||''''||'';
-- Line below assumes that 1 is the billing_address_type
v_where := v_where || ' AND customer_addresses.address_type_code = 1 ';
v_where := v_where || ' AND ';
v_where := v_where || ' ( ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MY%.COM%'||''''||' ';
v_where := v_where || ' OR ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MY%.COM.AU%'||''''||' ';
v_where := v_where || ' OR ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MY%.CA%'||''''||' ';
v_where := v_where || ' OR ';
v_where := v_where || ' UPPER(customer_contacts.web_site) LIKE '||''''||'%MY%.UK%'||''''||' ';
v_where := v_where || ' ) ';
WHILE (haveResultsOrAllQueriesDone = FALSE)
LOOP
CASE
WHEN (UPPER(p_action) =UPPER('search')) THEN
v_where_filter := '';
v_where_filter := v_where_filter || ' AND UPPER(addresses.state) = UPPER(trim(''' || p_state || ''')) ';
IF UPPER(p_exact_match) = UPPER('y') THEN
v_where_filter := v_where_filter || ' AND UPPER(customers.first_name) = UPPER(trim(''' || p_first_name || ''')) ';
ELSE
v_where_filter := v_where_filter || ' AND UPPER(SOUNDEX(customers.first_name)) = UPPER(SOUNDEX(trim(''' || p_first_name || '''))) ';
END IF;
IF UPPER(p_last_name) <> '' THEN
IF UPPER(p_exact_match) = UPPER('y') THEN
v_where_filter := v_where_filter || ' AND UPPER(customers.last_name) = UPPER(trim(''' || p_last_name || ''')) ';
ELSE
v_where_filter := v_where_filter || ' AND UPPER(SOUNDEX(customers.last_name)) = UPPER(SOUNDEX(trim(''' || p_last_name || ''')) ';
END IF;
END IF;
IF UPPER(p_city) <> '' THEN
v_where_filter := v_where_filter || ' AND UPPER(addresses.city) = UPPER(''' || p_city || ''') ';
END IF;
IF UPPER(p_zip_or_postalcode) <> '' THEN
v_where_filter := v_where_filter || ' AND UPPER(addresses.zip_or_postalcode) = UPPER(''' || p_zip_or_postalcode || ''') ';
END IF;
WHEN (p_action = 'locate') THEN
v_where_filter := '';
IF (haveQueriedLanguage = FALSE) THEN
IF (p_language_code <> '') THEN
v_where_filter := v_where_filter|| ' AND UPPER(customer_languages.language_code) = UPPER(''' || p_language_code || ''') ';
haveQueriedLanguage := TRUE;
END IF;
--ELSE
-- haveQueriedLanguage := FALSE;
END IF;
CASE
WHEN (haveQueriedZip = FALSE) THEN
v_where_filter := v_where_filter || ' AND UPPER(addresses.zip_or_postalcode) = UPPER(''' || p_zip_or_postalcode || ''') ';
IF (haveQueriedLanguage = FALSE) THEN
haveQueriedZip := TRUE;
END IF;
WHEN (haveQueriedCity = FALSE) THEN
IF (p_city <> '') THEN
v_where_filter := v_where_filter || ' AND UPPER(addresses.city) = UPPER('||''''|| p_city ||''''||') ' ;
ELSE
IF (p_country_code = 'UK') THEN
tempLikeZip := SUBSTR(p_zip_or_postalcode,( LENGTH(TRIM(p_zip_or_postalcode)) - 2 ));
v_where_filter := v_where_filter || ' AND UPPER(addresses.zip_or_postalcode) LIKE UPPER(TRIM('||'''%'||tempLikeZip ||''''||')) ' ;
ELSE
v_temp := 'SELECT city FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER(TRIM('||''''|| p_zip_or_postalcode ||''''||')) ';
OPEN cursor_locateAConsultant FOR v_temp ;
LOOP
FETCH cursor_locateAConsultant INTO cityMapped;
EXIT
WHEN cursor_locateAConsultant%NOTFOUND;
END LOOP;
CLOSE cursor_locateAConsultant;
cityMapped := TRIM(cityMapped);
v_where_filter := v_where_filter || ' AND UPPER(addresses.city) = UPPER('||''''|| cityMapped ||''''||') ' ;
END IF;
END IF;
haveQueriedCity := TRUE;
WHEN (haveQueriedCounty = FALSE) THEN
IF (p_country_code = 'UK') THEN
tempLikeZip := UPPER(SUBSTR(p_zip_or_postalcode,( LENGTH(TRIM(p_zip_or_postalcode)) - 3 )));
v_where_filter := v_where_filter || ' AND UPPER(addresses.zip_or_postalcode) LIKE '||'''%'||tempLikeZip ||''''||' ' ;
ELSE
OPEN cursor_locateAConsultant FOR 'SELECT county FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER('||''''|| p_zip_or_postalcode ||''''||') ' ;
LOOP
FETCH cursor_locateAConsultant INTO countyMapped;
EXIT
WHEN cursor_locateAConsultant%NOTFOUND;
END LOOP;
CLOSE cursor_locateAConsultant;
countyMapped := TRIM(countyMapped);
v_where_filter := v_where_filter || ' AND UPPER(addresses.province_county) = UPPER(TRIM('||''''|| countyMapped ||''''||')) ' ;
END IF;
haveQueriedCounty := TRUE;
WHEN (haveQueriedState = FALSE) THEN
IF (p_state <> '') THEN
v_where_filter := v_where_filter || ' AND UPPER(addresses.state) = UPPER('||''''|| p_state ||''''||') ' ;
ELSE
IF (p_country_code = 'UK') THEN
tempLikeZip := UPPER(SUBSTR(p_zip_or_postalcode,( LENGTH(TRIM(p_zip_or_postalcode)) - 4 )));
v_where_filter := v_where_filter || ' AND UPPER(addresses.zip_or_postalcode) LIKE '||'''%'||tempLikeZip ||''''||' ' ;
ELSE
OPEN cursor_locateAConsultant FOR 'SELECT state FROM ref_zip_mappings where UPPER(zip_or_postalcode) = UPPER('||''''|| p_zip_or_postalcode ||''''||') ' ;
LOOP
FETCH cursor_locateAConsultant INTO stateMapped;
EXIT
WHEN cursor_locateAConsultant%NOTFOUND;
END LOOP;
CLOSE cursor_locateAConsultant;
stateMapped := TRIM(stateMapped);
v_where_filter := v_where_filter || ' AND UPPER(addresses.state) = UPPER(TRIM('||''''|| stateMapped ||''''||')) ' ;
END IF;
haveQueriedState := TRUE;
END IF;
END CASE;
END CASE;
v_select1 := 'SELECT 1 ' || v_from || v_where || v_where_filter;
OPEN v_cursor FOR v_select1;
DBMS_OUTPUT.PUT_LINE(v_select1);
FETCH v_cursor INTO v_hasRecords;
IF (v_hasRecords = 1) THEN
haveResultsOrAllQueriesDone := TRUE;
ELSE
haveResultsOrAllQueriesDone := FALSE;
END IF;
IF ((haveResultsOrAllQueriesDone = TRUE) OR (haveQueriedState = TRUE)) THEN
v_sql := v_select || v_from || v_where || v_where_filter;
OPEN v_cursor FOR v_sql;
DBMS_OUTPUT.PUT_LINE(v_sql);
RETURN v_cursor;
END IF;
END LOOP;
END;
END; -
// this is my script I Want to run this script again nd again
doc = activeDocument;
doAction("Action 4","Set 1");
doc = activeDocument;
if (doc.height > doc.width)
doAction("Action 1n","Set 1");
doc = activeDocument;
if (doc.height > doc.width)
doAction("Action 1nn","Set 1");
else {
doAction("Action 5","Set 1");
if (doc.height < doc.width)
doAction("Action 1n","Set 1");
doc = activeDocument;
if (doc.height < doc.width)
doAction("Action 1nn","Set 1");
else {
doAction("Action 5","Set 1");
and also before this i want to open folder in that it should open psd 001 and so on...and when after looping it should folder in that it should open psd 002.... OR explain me easy way to looping. as i dont no scripting language.
Thanks ...It is easy to create a template for a collage like you show and populate it with your images with a script. However there are some limitations in Photoshop that may impose limitation on you. It may also be hard to support some thing and make it easy to create templates. Something like rotating image and perspective placement most likely can only be done by using complex templates that are hard to create and the scripts would need to replace smart object layers embedded object contents with image that are the same size as the current embedded object. I chose to make it easy to make templates and not support rotation and perspective with automation. You can still create template like you show, but images will be place in without rotation and perspective. However images will be placed image layers in the populated collage that you can change its transform manually to add rotation and perspective. You can even create a batch if these collages and add the rotation and perspective later. View Screen Capture in new browser tab or window so you can scale to actual pixels this site scales uploaded image poorly.
A video showing on how script population works http://www.mouseprints.net/old/dpr/Populate911_720p.mp4
Photo Collage Toolkit UPDATED Made Rotate for Best Fit an option in PasteImageRoll.jsx Edit to customize your default settings.
Photoshop scripting is powerful and I believe this package demonstrates this.
The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.
There are twelve scripts in this package they provide the following functions:
TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder
PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.
Documentation and Examples -
I need to loop through 1 table and read another until a value changes
i need to read a table and sum the quantity field until a reason code changes. how do I go about doing this?
sort itab by reasoncode.
Loop at itab.
quantiy = quanity + itab-quantity.
at end of reasoncode.
jtab-reasoncode = itab-reasoncodee.
jtab-sum = quantity.
append jtab.
clear quantity.
endat
endloop.
or
sort itab by reasoncode.
loop at itab.
at end of reasoncode.
sum.
jtab = itab.
append jtab.
endat.
endloop.
or
let us say itab and jtab are two tables and you want to loop through itab and read jtab for reasoncodes.
if jtab has only one entry for each entry in itab then use read else use loop.
loop at itab.
loop at jtab where reasoncode = itab-reasoncode.
quantiy = quantiy + jtab-quanity.
endloop.
endloop.
or
loop at itab.
read table jtab with key reasoncode = itab-reasoncode.
if sy-subrc eq 0.
endif
endloop. -
Need to loop through Recursive node
Hi Everyone,
I am having troubles looping through a node to get a boolean value called "Check".
Basically I am using the TreeNesteedInTable UI. One of the columns I display is the "Check" mentioned above. Basically the user can go through the tree structure and check his/her options. I should then be able to loop through this structure to get all the records "Checked". My application is not doing this.
At the moment I am looping through the top level node - think this is where my probelm is because this node can only be singleton! This means that I then have to loop through the Recusrsive node of this type to get the values as the recusrive is always non-singleton en must therefor contain the elements I am looking for. But, i do not know how tho get access to this node. Is this the correct way of doing it, or how should it be done otherwise?
Many thanks,
ChristiaanHI,
I got it to work like this:
public void addICAMForIncident( ) {
//@@begin addICAMForIncident()
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
try {
int count;
Bapi1240_Rc rootCause;
IPublicEhs_icam.IAbsentOrFailedControlsElement existingAbsentOrFailedControlsElement;
IPublicEhs_icam.IAbsentOrFailedControlsElement recursive;
IPublicEhs_icam.IAbsentOrFailedControlsElement recursiveChildElement;
IPublicEhs_icam.IAbsentOrFailedControlsNode recursiveChildNode;
// if(wdContext.nodeAbsentOrFailedControls() != null){
// set header data:
wdContext.currentHeader_CreateElement().setRecord_No(wdContext.currentHeader_GDElement().getRecord_No());
wdContext.currentHeader_CreateElement().setRecno_Root(wdContext.currentHeader_GDElement().getRecno_Root());
wdContext.currentHeader_CreateElement().setIncident(wdContext.currentGPInputNodeElement().getIPIncidentNum());
//Top Level Node (Singleton)
existingAbsentOrFailedControlsElement = wdContext.currentAbsentOrFailedControlsElement();
//We need to go through the values of the RECURSIVE node as that is where the values are!
//Each time we expand a node in the tree this recursive node is filled with values
for(int i = 0;i<existingAbsentOrFailedControlsElement.nodeRecursiveAbsentOrFailedControl().size();i++)
recursiveChildNode = existingAbsentOrFailedControlsElement.nodeRecursiveAbsentOrFailedControl().nodeRecursiveAbsentOrFailedControl(i);
for(int m = 0;m<recursiveChildNode.size();m++)
recursiveChildElement = recursiveChildNode.getAbsentOrFailedControlsElementAt(m);
if(recursiveChildElement.getCheck())
//New line in the "table":
rootCause = new Bapi1240_Rc();
rootCause.setFunction("009");
rootCause.setHierarchy_Key("EHS_IAL_STD");
rootCause.setNode_Key(recursiveChildElement.getNODE_ID());
rootCause.setRef_Recno(wdContext.currentHeader_GDElement().getRecord_No());
rootCause.setRef_Object("IAL");
rootCause.setRef_Recno_Smeas("0");
rootCause.setPrimarykey("00000000000000000001");
rootCause.setForeignkey("00000000000000000001");
rootCause.setFlgfrgnkey(true);
rootCause.setFlgprimkey(true);
rootCause.setFlag_Selected(true);
//add the line to the "table":
createInput.addRootcause(rootCause);
}//end if
}//end for
}// end for
// execute:
wdContext.currentBapi_Bus1240_Create_InputElement().modelObject().execute();
// invalidate the output structure:
wdContext.nodeOutput_Create().invalidate();
} catch (CMIException ex) {
msgMgr.reportException(ex.getLocalizedMessage(), true);
//@@end -
Hello folks,
I build a VI that manages the velocity control of a motor. Inside the VI I run a timed loop forever.
As my project uses 6 motors. I need to run 6 of those VIs in parallel.
Everything remains the same except for the communication channels (Tasks).
I've collected those Tasks inside an array
Is there a way of using a loop construction to generate these 6 VIs.
Hence the outer for loop needs to finish while the inner VI keeps running?
Maybe there is already some reading material available and I'm just seraching under the wrong subjects.
PhiliI had a similar need not too long ago except I was running under Fieldpoint RT some of the time and from a Windows PC some of the time.
I learned that templates are not supported under Fieldpoint RT -- perhaps this restriction also holds for PC-based LabVIEW RT? I ended up with 2 work-arounds:
1. Poor-man's template: I would manually perform a file copy from the "template" vi to uniquely-named instance vi's. These simply had a numeric value appended to the base filename, just like a real template vi would have done. Here are the pros/cons. The file copy was VERY slow under Fieldpoint because the file system is implemented on slow flash memory. It took many seconds to instantiate a handful of vi's through the file copy process. This is unlikely to be a problem on a PC-based file system. Unlike real templates, these didn't prompt you to save if you closed the front panels. I had to manage deleting the files when done -- not a big deal, just another bit of housekeeping. And because they were regular vi's, the front panels could be opened for interaction and monitoring of the control loops.
2. Reentrant vi. This launched separate instances reasonably quickly. However the front panels could not be used for interaction or monitoring.
I used technique 1 for most of the development so I could use the front panels for debug purposes. Then I switched to technique 2 for the final app to get rid of delays when instantiating vi's.
-Kevin P. -
Hi all
shayan here
First of all sory for my last post in which i posted a lot of code...actuallly i want to describe my problem in details because it is really unknown to me......
Now i will desdcrible it in simple.Hope fully all of you can understand and give me a idea to overcome this problem......
My problem is that i had generated a record in tabluler form through Select statement......means i have made a coursor of select statement and via loop i added it to tabuler form element like this
Registration Enrollment
12321 312312
231312 23123
1232 123123
Now i had added another display item in which ihave to calculate another thing like this
Registration Enrollment CGPA
12321 312312 2.14
231312 23123 1.23
1232 123123
I have done it but problem is that it is showing the cgpa in front of only one item...
not on all
i dont know why??????
also i want to insert this into another table like this....if this CGPA is final then insert it into final_CGPA table else it will update table with this CGPA.....
I had written the Insert and update statement on when button pressed button but it is not updateing or inserting.....
any help regarding this is highly appreciated
Thanks in advance
Shayan
[email protected]Hello,
Forms always creates the first record in each block, but if you want to add manually some more records, you have to use the Create_Record built-in for each new record you want to create in the block.
Francois -
okay so i'm trying to loop the animation. i tryed using a for loop to loop it 4 times and it looped my trace statemnt 4 times but not my animation. any suggestions on how to loop the animation?
below is the code i have tried
import fl.motion.Animator;
for (var i:Number = 0; i < 5; i++)
trace(i);
var this_xml:XML = <Motion duration="449" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>
<Source frameRate="19" x="0" y="0" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="cowanimation">
<dimensions>
<geom:Rectangle left="-8.5" top="-21.9" width="17.05" height="43.85"/>
</dimensions>
<transformationPoint>
<geom:Point x="0.49853372434017595" y="0.4994298745724059"/>
</transformationPoint>
</Source>
</source>
<Keyframe index="0" tweenSnap="true">
<tweens>
<CustomEase>
<geom:Point x="0.2096" y="0"/>
<geom:Point x="0.811" y="1"/>
</CustomEase>
</tweens>
</Keyframe>
<Keyframe index="194" tweenSnap="true" x="67.65" y="-80.3" rotation="60">
<tweens>
<CustomEase>
<geom:Point x="0.2096" y="0"/>
<geom:Point x="0.811" y="1"/>
</CustomEase>
</tweens>
</Keyframe>
<Keyframe index="240" tweenSnap="true" x="77.75" y="-62.25" rotation="-150">
<tweens>
<CustomEase>
<geom:Point x="0.2096" y="0"/>
<geom:Point x="0.811" y="1"/>
</CustomEase>
</tweens>
</Keyframe>
<Keyframe index="378" tweenSnap="true" x="17.35" y="13.05">
<tweens>
<CustomEase>
<geom:Point x="0.2096" y="0"/>
<geom:Point x="0.811" y="1"/>
</CustomEase>
</tweens>
</Keyframe>
<Keyframe index="448" tweenSnap="true" x="0" y="0" rotation="0">
<tweens>
<CustomEase>
<geom:Point x="0.2096" y="0"/>
<geom:Point x="0.811" y="1"/>
</CustomEase>
</tweens>
</Keyframe>
</Motion>;
var this_animator:Animator = new Animator(this_xml,this);
this_animator.play()The problem with a for and while loop is that it will take complete the entire loop during the frame. That is why u dint see it. What u could do is increase the index by 1 each frame and then display that movie clip frame. Via gotoAndStop(index).
-
Need nested loop's solution....
hi..
i have done following coding for my one senario..i've used nested loop.but can anyone pls give me other solution than nested loop statement?
i dont wnat to use nested loop...
SELECT WI_ID WI_STAT WI_CD WI_AAGENT FROM SWWWIHEAD "FETCHING WORK ITEM DATA FROM THE SWWWIHEAD
INTO TABLE IT_SWWWIHEAD
WHERE WI_CD IN SO_WI_CD.
SORT IT_SWWWIHEAD.
IF SY-SUBRC = 0.
<b> LOOP AT IT_SWWWIHEAD INTO WA_SWWWIHEAD.</b>
CALL FUNCTION 'SWI_GET_DEPENDENT_WORKITEMS' "FUNCTION MODULE TO GET DEPENDENT WORK ITEM ID, IF ANY.
EXPORTING
WI_ID = WA_SWWWIHEAD-WI_ID
TABLES
DEPENDENT_WIS = IT_SWWWIHEAD_D.
IF IT_SWWWIHEAD_D IS NOT INITIAL.
DELETE IT_SWWWIHEAD_D WHERE WI_TYPE <> 'W'.
SORT IT_SWWWIHEAD_D.
<b> LOOP AT IT_SWWWIHEAD_D INTO WA_SWWWIHEAD_D.</b>
CALL FUNCTION 'SAP_WAPI_READ_CONTAINER' "FUNCTION MODULE TO GET DATA FROM EVERY DEPENDENT ID.
EXPORTING
WORKITEM_ID = WA_SWWWIHEAD_D-WI_ID
LANGUAGE = SY-LANGU
USER = SY-UNAME
IMPORTING
RETURN_CODE =
IFS_XML_CONTAINER =
IFS_XML_CONTAINER_SCHEMA =
TABLES
SIMPLE_CONTAINER = IT_SIM_CONT
MESSAGE_LINES =
MESSAGE_STRUCT =
SUBCONTAINER_BOR_OBJECTS =
SUBCONTAINER_ALL_OBJECTS = IT_SUBCONTAINER
READ TABLE IT_SIM_CONT
INTO WA_SIM_CONT WITH KEY ELEMENT = '_WI_RESULT'. "getting the result(approved or rejected).
IF SY-SUBRC = 0.
IF wa_sim_cont-value = '0001'.
WA_FINAL-WI_STAT = 'APPROVED'.
ELSEIF WA_SIM_CONT-VALUE = '0002'.
WA_FINAL-WI_STAT = 'REJECTED'.
ENDIF.
ENDIF.
READ TABLE IT_SUBCONTAINER
INTO WA_SUBCONTAINER WITH KEY ELEMENT = 'SODATA'. "getting SO DOCUMENT for this workitem.
IF SY-SUBRC = 0.
WA_FINAL-WI_AAGENT = WA_SWWWIHEAD_D-WI_AAGENT.
ENDIF.
WA_FINAL-WI_ID = WA_SWWWIHEAD-WI_ID.
WA_FINAL-WI_ID_D = WA_SWWWIHEAD_D-WI_ID.
WA_FINAL-WI_CD = WA_SWWWIHEAD-WI_CD.
WA_FINAL-WI_SO = wa_subcontainer-value+0(10).
WA_FINAL-WI_RESULT = WA_SIM_CONT-VALUE.
SELECT SINGLE VKORG MAHDT FROM VBAK
INTO (VKORG, MAHDT)
WHERE VBELN = WA_FINAL-WI_SO.
IF SY-SUBRC = 0.
WA_FINAL-WI_VKORG = VKORG.
IF MAHDT <> '00000000'.
WA_FINAL-WI_FINAL_RESULT = 'OK'.
ELSE.
WA_FINAL-WI_FINAL_RESULT = 'PENDING'.
ENDIF.
ENDIF.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
<b> ENDLOOP.</b>
CLEAR IT_SWWWIHEAD_D[].
CLEAR IT_SIM_CONT[].
ENDIF.
<b> ENDLOOP.</b> ENDIF.hi sagar,
Pls go through the following explanations for understanding abt control level processing.
Control level processing is allowed within a LOOP over an internal table. This means that you can divide sequences of entries into groups based on the contents of certain fields.
Internal tables are divided into groups according to the sequence of the fields in the line structure. The first column defines the highest control level and so on. The control level hierarchy must be known when you create the internal table.
The control levels are formed by sorting the internal table in the sequence of its structure, that is, by the first field first, then by the second field, and so on. Tables in which the table key occurs at the start of the table are particularly suitable for control level processing.
The following diagram illustrates control level processing in a sorted table, where different field contents in the first three fields are indicated by different colors:
Each change of color in a column indicates a control level change in the corresponding hierarchy level. Within the processing block of a loop, you can use the control level statement AT to react to a control level change. This enables you to restrict statements to a certain set of lines. You can thus use the SUM statement to calculate totals from subsets of all lines.
The AT statement introduces a statement block that you end with the ENDAT statement.
AT <level>.
<statement block>
ENDAT.
You can react to the following control level changes:
<level>
Meaning
FIRST
First line of the internal table
LAST
Last line of the internal table
NEW <f>
Beginning of a group of lines with the same contents in the field <f> and in the fields left of <f>
END Of <f>
End of a group of lines with the same contents in the field <f> and in the fields left of <f>
You can use control level statements to react to control breaks in internal tables instead of programming them yourself with logical expressions. Within the loop, you must order the AT-ENDAT statement blocks according to the hierarchy of the control levels. If the internal table has the columns <f1>, <f 2>, ...., and if it is sorted by these columns, you must program the loop as follows:
LOOP AT <itab>.
AT FIRST. ... ENDAT.
AT NEW <f1>. ...... ENDAT.
AT NEW <f2 >. ...... ENDAT.
<single line processing>
AT END OF <f2>. ... ENDAT.
AT END OF <f1>. ... ENDAT.
AT LAST. .... ENDAT.
ENDLOOP.
The innermost hierarchy level <single line processing> processes the table lines that do not correspond to a control level change. You do not have to use all control level statements. But you must place the used ones in the above sequence. You should not use control level statements in loops where the line selection is restricted by WHERE or FROM and TO. Neither should the table be modified during the loop.
If a control level field <fi> is not known until runtime, you can specify it dynamically as (<n i>) where <n i> contains the field of <f i>. If <n i> is empty at runtime, the criterion for changing the control level is ignored. You can restrict the search to partial fields by specifying offset and length.
If you are working with a work area <wa>, it does not contain the current line in the AT... ENDAT statement block. All character fields to the right of the current group key are filled with asterisks (*). All other fields to the right of the current group key contain their initial value.
Within an AT...ENDAT block, you can calculate the contents of the numeric fields of the corresponding control level using the SUM statement.
SUM.
You can only use this statement within a LOOP. If you use SUM in an AT - ENDAT block, the system calculates totals for the numeric fields of all lines in the current line group and writes them to the corresponding fields in the work area (see example in ). If you use the SUM statement outside an AT - ENDAT block (single entry processing), the system calculates totals for the numeric fields of all lines of the internal table in each loop pass and writes them to the corresponding fields of the work area. It therefore only makes sense to use the SUM statement in AT...ENDAT blocks.
If the table contains a nested table, you cannot use the SUM statement. Neither can you use it if you are using a field symbol instead of a work area in the LOOP statement.
Examples
DATA: BEGIN OF LINE,
COL1 TYPE C,
COL2 TYPE I,
COL3 TYPE I,
END OF LINE.
DATA ITAB LIKE HASHED TABLE OF LINE
WITH UNIQUE KEY COL1 COL2.
LINE-COL1 = 'A'.
DO 3 TIMES.
LINE-COL2 = SY-INDEX.
LINE-COL3 = SY-INDEX ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
LINE-COL1 = 'B'.
DO 3 TIMES.
LINE-COL2 = 2 * SY-INDEX.
LINE-COL3 = ( 2 * SY-INDEX ) ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
SORT ITAB.
LOOP AT ITAB INTO LINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
AT END OF COL1.
SUM.
ULINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
SKIP.
ENDAT.
AT LAST.
SUM.
ULINE.
WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
ENDAT.
ENDLOOP.
The output is:
A 1 1
A 2 4
A 3 9
A 6 14
B 2 4
B 4 16
B 6 36
B 12 56
18 70
The program creates a hashed table ITAB, fills it with six lines, and sorts it. In the LOOP - ENDLOOP block, the work area LINE is output for each loop pass. The first field of the table key, COL1, is used for control level processing. The total for all numeric fields is always calculated when the contents of COL1 change and when the system is in the last loop pass.
DATA: BEGIN OF LINE,
CARRID TYPE SBOOK-CARRID,
CONNID TYPE SBOOK-CONNID,
FLDATE TYPE SBOOK-FLDATE,
CUSTTYPE TYPE SBOOK-CUSTTYPE,
CLASS TYPE SBOOK-CLASS,
BOOKID TYPE SBOOK-BOOKID,
END OF LINE.
DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY TABLE LINE.
SELECT CARRID CONNID FLDATE CUSTTYPE CLASS BOOKID
FROM SBOOK INTO CORRESPONDING FIELDS OF TABLE ITAB.
LOOP AT ITAB INTO LINE.
AT FIRST.
WRITE / 'List of Bookings'.
ULINE.
ENDAT.
AT NEW CARRID.
WRITE: / 'Carrid:', LINE-CARRID.
ENDAT.
AT NEW CONNID.
WRITE: / 'Connid:', LINE-CONNID.
ENDAT.
AT NEW FLDATE.
WRITE: / 'Fldate:', LINE-FLDATE.
ENDAT.
AT NEW CUSTTYPE.
WRITE: / 'Custtype:', LINE-CUSTTYPE.
ENDAT.
WRITE: / LINE-BOOKID, LINE-CLASS.
AT END OF CLASS.
ULINE.
ENDAT.
ENDLOOP.
In this example, the sorted internal table ITAB is filled with data from the database table SBOOK using the Open SQL statement SELECT. The sequence of the columns in the internal table defines the control level hierarchy. Since the table key is the entire line, the sort sequence and the control level hierarchy are the same. The sequence of the AT-ENDAT blocks within the LOOP and ENDLOOP statements is important.
The output is as follows:
List of Bookings
Carrid: AA
Connid: 0017
Fldate: 1998/11/22
Custtype: B
00063509 C
00063517 C
00063532 F
00063535 F
Custtype: P
00063653 C
00063654 C
00063668 F
00063670 F
Fldate: 1998/29/11
Custtype: B
00064120 C
00064121 C
and so on.
<b>pls reward if helpful.</b> -
Hi I need to loop my video to play in a shop over again?
Hi I would like to know how to loop my edited video to play over and over in a shop window.
Can I do this in iDVD 7.1.2 or anywhere else? ThanksYes, you can do it in iDVD:
Launch iDVD
and click on Create New Project - navigate to where you want to save the project and name it, then when it opens, just ignore whatever menu is there and click on the button with the boxes to take you to the graphical structure view:
Drag your edited movie into the box that says "Drag content here to automatically play when disc in inserted."
after you drag the content in, click on the box by the title so that it turns blue, then go to the menu Advanced and select Loop Movie
Now you can do a preview and the movie will start, play through and loop automatically. It basically ignores the whole menu thing.
Burn your DVD - make a couple in case the player scratches one. When you do the burn, you will likely get a warning that there are problems because the menu has no buttons - you can ignore them and just burn the disc.
Be sure to check it before you hand it out!
MtD -
Help needed with looping a function
Hello experts,
I am in a bit of a mess of ideas,
I have a form with various search fields.
based on the values i am passing, i am returning some values back to my form
below is my function
CREATE OR REPLACE function LOTTO_EROUTES.f_forecast(p_ret_num in varchar2,
p_item_id in number,
p_curr_date in date,
p_expected_stock out number ,
p_actual_stock out number,
p_inst_settled out number,
p_prev_date out date ,
p_range out number,
l_settled_avg out number,
p_coefficient out number
return number is
l_forecast_num number;
l_curr_cdc varchar2(6);
l_prev_cdc varchar2(6);
l_forecast_err varchar2(50) := 0;
l_game_id number;
begin
select game_id,STOCK_COEFF_LEVEL_DAYS,IPS_SETTLED_RANGE_DAYS
into l_game_id,p_coefficient,p_range
from items
where item_id =p_item_id;
l_curr_cdc := ltrim(rtrim(to_char(f_get_cdc_num(p_curr_date),999999)));
l_prev_cdc := (l_curr_cdc - p_range);
p_prev_date := f_get_cdc_date(l_prev_cdc);
select count(serial_number)
into p_inst_settled
from LOTTO_INSTANT_TRACK
where game_id = l_game_id
and retailer_num = p_ret_num
and status = 'Settled'
and cdc between l_prev_cdc and l_curr_cdc ;
l_settled_avg := ceil(p_inst_settled / p_range);
p_expected_stock := ceil(l_settled_avg * p_coefficient);
select count(serial_number)
into p_actual_stock
from LOTTO_INSTANT_track
where game_id = l_game_id
and retailer_num = p_ret_num
and status like 'Confirmed';
l_forecast_num := ceil((p_expected_stock - p_actual_stock));
return l_forecast_num;
exception
when others then
dbms_output.put_line(sqlerrm);
return l_forecast_err;
end;
/Now in my function i am passing 1 single value for p_ret_num(retailer number), i value for p_item_id and p-curr_date which is default sysdate.
now i should be able to pass all retailer number and return those values accordingly.
I am thinking of having an LOV that will have "ALL" option whereby the user will select and it should return all its corresponding values.
I know i should be having a loop but don't know how to do that. Can anyone guide me plz.
Thanksnot using cursor for performance issues. well from what i've learnt.
yes, exactly. each and everytime its just replacing the values in the first row itself.
unhandled exception error
f_forecast function
CREATE OR REPLACE function LOTTO_EROUTES.f_forecast(p_ret_num in varchar2,
p_item_id in number,
p_curr_date in date,
p_salesperson out varchar2,
p_expected_stock out number,
p_actual_stock out number,
p_inst_settled out number,
p_prev_date out date ,
p_range out number,
l_settled_avg out number,
p_coefficient out number
return number is
l_forecast_num number;
l_curr_cdc varchar2(6);
l_prev_cdc varchar2(6);
l_forecast_err varchar2(50) := 0;
l_game_id number;
begin
select game_id,STOCK_COEFF_LEVEL_DAYS,IPS_SETTLED_RANGE_DAYS
into l_game_id,p_coefficient,p_range
from items
where item_id =p_item_id;
select salesperson
into p_salesperson
from lotto_retailers
where retailer_num = p_ret_num;
l_curr_cdc := ltrim(rtrim(to_char(f_get_cdc_num(p_curr_date),999999)));
l_prev_cdc := (l_curr_cdc - p_range);
p_prev_date := f_get_cdc_date(l_prev_cdc);
select count(serial_number)
into p_inst_settled
from LOTTO_INSTANT_TRACK
where game_id = l_game_id
and retailer_num = p_ret_num
and status = 'Settled'
and cdc between l_prev_cdc and l_curr_cdc ;
l_settled_avg := ceil(p_inst_settled / p_range);
p_expected_stock := ceil(l_settled_avg * p_coefficient);
select count(serial_number)
into p_actual_stock
from LOTTO_INSTANT_track
where game_id = l_game_id
and retailer_num = p_ret_num
and status like 'Confirmed';
l_forecast_num := ceil((p_expected_stock - p_actual_stock));
return l_forecast_num;
exception
when others then
dbms_output.put_line(sqlerrm);
return l_forecast_err;
end;
/calling in my button
declare
default_date date := :oe_header.order_date;
begin
:oe_lines.order_date_disp := default_date;
go_block('OE_LINES');
FOR Get_Ret IN (select retailer_num
from lotto_retailers
where agent_status_id = 2
AND retailer_num = DECODE(:criteria.retailer_num,0,retailer_num,:criteria.retailer_num))
LOOP
:OE_LINES.retailer_num := Get_Ret.retailer_num;
:OE_LINES.FORECAST_CNT := f_forecast(
:OE_LINES.retailer_num ,
:criteria.item_id,
:OE_LINES.order_date_disp,
:OE_LINES.salesperson,
:OE_LINES.expected_stock,
:OE_LINES.current_retailer_stock,
:OE_LINES.avg_calculated_amt,
:OE_LINES.from_date,
:OE_LINES.calc_stock_coefficient,
:OE_LINES.avg_daily_sales,
:OE_LINES.stock_coefficient_used
:OE_LINES.AVG_WEEKLY_SALES := ( :OE_LINES.avg_daily_sales * 7 );
next_record;
END LOOP;
END; -
Need to loop to certain point on mouse-click
Hello,
for work I am trying to create a visual for a simple electric circuit. What I want is that when the circuit opening is clicked, it closes and the light bulb comes on. When it is clicked again, it opens and the light bulb turns off.
I have it working fine when I try to play it one time through. However, I do not know how to send it back to the beginning and run through the entire timeline again.
On frame 1 I have this actionscript:
stop();
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);
function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void
gotoAndPlay(2);
This plays till frame 11, which has the script:
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
gotoAndPlay(13);
stop();
It then plays till the end (frame 24), where I put in the script:
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayAtFrame);
function fl_ClickToGoToAndPlayAtFrame(event:MouseEvent):void
gotoAndPlay(2);
Everything works great, even when it is sent back to frame 2. The problem is that when it reaches 11 again, clicking the mouse always sends it back to 2 instead of on to 13.
I hope this makes sense, I don't really know any better ways to explain it. It's probably a simple fix, but I'm new to actionscript and this has been driving me crazy. Any help would be appreciated.
Thanks,
Emilyuse:
On frame 1 I have this actionscript:
stop();
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);
function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void
gotoAndPlay(2);
This plays till frame 11, which has the script:
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
gotoAndPlay(13);
stop();
It then plays till the end (frame 24), where I put in the script:
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayAtFrame24);
function fl_ClickToGoToAndPlayAtFrame24(event:MouseEvent):void
gotoAndPlay(2);
Everything works great, even when it is sent back to frame 2. The problem is that when it reaches 11 again, clicking the mouse always sends it back to 2 instead of on to 13.
I hope this makes sense, I don't really know any better ways to explain it. It's probably a simple fix, but I'm new to actionscript and this has been driving me crazy. Any help would be appreciated.
Thanks,
Emily
Maybe you are looking for
-
Validation on Posting Data in MIGO
Dear Experts, My requirement is to put validation on Posting date during MIGO. How can i do that? Can i do it from OMJX? Regards,
-
Abap client proxy to xi - no data found
Hi experts I m working on abap client proxy to file scenario where in I m sending data from R/3 system to legacy system via xi , but after doing all the configurations and running the abap program for triggering client proxy , i dont find any data o
-
The file "Open With" option for pdf files was changed by MS Office to open all files with Outlook (it was an operator error - mine ) but my problem is that I can't change it back. The image on the icon shows office and not the standard pdf file i
-
Hi, I would like to know from where system retrive the price during good issue for customer consignment using movement 633? Thank you
-
I want to know how can I fix that gimp driver error I am getting can anyone help I disconnect and connect the usb cable but I cannot add the printer driver (client-error-request-value-too-long) thats the error I get how can I fix it hello anyone can