Avoid multiple function calls in query
I have a query as follows:
select
col1,
substr(test_func(col2,test_func(col3)) , 1 , length(test_func(col2,test_func(col3))),
col3,
substr(test_func(col2,test_func(col3)) , 1 , length(test_func(col2,test_func(col3)) - 5),
col4
from table1
where pk_column = pi_param;
The test_func has couple of select queries inside and returns a string which i need to split in a particular way and return as two different column values.
To optimize performance, I need to reduce the multiple calls to test_func function.
I tried query with query like below:
select
col1,
substr(func_ret_value,1,length(func_ret_value)) value1,
col3
substr(func_ret_value,1, length(func_ret_value) - 5 ) value2,
col4
from(
select
col1,
col3,
test_func(col2,test_func(col3)) func_ret_value
col4
from table1
where pk_column = pi_param);
Above approach works but when i check the trace of above query , it still shows multiple executions( of the select queries inside the function.
Also there is no performance gain.
How do i avoid these multiple calls to the function and improve performance.
Thanks.
Hi,
You can call the function once, in a sub-query, then use it (by referencing the column alias tf in the example below) as often as you want to in a super-query, like this:
WITH got_tf AS
SELECT table1.* -- or list columns needed
, test_func ( col2
, test_func (col3)
) AS tf
FROM table1
SELECT col1
, tf AS value1 -- = SUBSTR (tf, 1, LENGTH (tf))
, col3
, SUBSTR ( tf
, 1
, LENGTH (tf) - 5
) AS value2
, col4
FROM got_tf
WHERE pk_column = pi_param;If possible, create the function as DETERMINISTIC.
Similar Messages
-
Is there a way to avoid the function call ?
Given the following test case
CREATE USER TESTER
IDENTIFIED BY "tester"
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
GRANT CONNECT, RESOURCE TO TESTER
GRANT CREATE TYPE TO TESTER
GRANT CREATE SESSION TO TESTER
GRANT CREATE PROCEDURE TO TESTER
GRANT CREATE TABLE TO TESTER
GRANT UNLIMITED TABLESPACE TO TESTER
ALTER USER TESTER QUOTA UNLIMITED ON USERS
COMMIT
CONNECT TESTER/tester
CREATE OR REPLACE TYPE TESTER.PATTERN_LIST AS TABLE OF VARCHAR2(1023 CHAR)
SHOW ERRORS
CREATE TABLE TESTER.PARENT_TABLE
FIELD_ID NUMBER(10) NOT NULL,
FIELD_NAME VARCHAR2( 255 CHAR) NOT NULL,
FIELD_PATH VARCHAR2(1023 CHAR) NOT NULL,
FIELD_VALUE VARCHAR2( 255 CHAR)
CREATE TABLE TESTER.CHILD_TABLE
FIELD_PATH VARCHAR2(1023 CHAR) NOT NULL,
MIN_STR_LEN NUMBER(10),
MAX_STR_LEN NUMBER(10),
PATTERNS TESTER.PATTERN_LIST
NESTED TABLE PATTERNS STORE AS PATTERN_TABLE RETURN AS VALUE
ALTER TABLE TESTER.PARENT_TABLE ADD (
CONSTRAINT PARENT_TABLE_PK
PRIMARY KEY
(FIELD_ID))
INSERT ALL
INTO TESTER.PARENT_TABLE
VALUES (1, 'FIELD_A', '/A', NULL)
INTO TESTER.PARENT_TABLE
VALUES (2, 'FIELD_AB', '/A/B', '20090731')
INTO TESTER.PARENT_TABLE
VALUES (3, 'FIELD_AC', '/A/C', '2167')
INTO TESTER.PARENT_TABLE
VALUES (4, 'FIELD_AC', '/A/C', '1144')
INTO TESTER.PARENT_TABLE
VALUES (5, 'FIELD_AD', '/A/D', 'XS10')
INTO TESTER.PARENT_TABLE
VALUES (6, 'FIELD_AB', '/A/B', '20090229')
INTO TESTER.PARENT_TABLE
VALUES (7, 'FIELD_AD', '/A/D', 'ART')
INTO TESTER.PARENT_TABLE
VALUES (8, 'FIELD_AD', '/A/D', 'TESTED')
INTO TESTER.CHILD_TABLE
VALUES ('/A', NULL, NULL, PATTERN_LIST())
INTO TESTER.CHILD_TABLE
VALUES ('/A/B', NULL, NULL, PATTERN_LIST( '[12][0-9]{3}[0][13578]([0][1-9]|[12][0-9]|[3][01])'
, '[12][0-9]{3}[0][469]([0][1-9]|[12][0-9]|[3][0])'
, '[12][0-9]{3}[1][02][3][1]'
, '[12][0-9]{3}[1][1][3][0]'
, '[12][0-9]{3}[0][2][2][8]'
, '([2][048]|[1][26])([02468][048]|[13579][26])[0][2][2][9]'))
INTO TESTER.CHILD_TABLE
VALUES ('/A/C', NULL, NULL, PATTERN_LIST( '[0-1][0-9][0-5][0-9]'
, '[2][0-3][0-5][0-9]'))
INTO TESTER.CHILD_TABLE
VALUES ('/A/D', 3, 4, PATTERN_LIST('[^0-9]*'))
SELECT * FROM DUAL
CREATE OR REPLACE FUNCTION TESTER.MATCH_PATTERN(p_value IN VARCHAR2, p_patterns IN TESTER.PATTERN_LIST) RETURN NUMBER
AS
v_count NUMBER := 0;
BEGIN
SELECT COUNT(*)
INTO v_count
FROM TABLE(p_patterns)
WHERE REGEXP_SUBSTR(p_value, COLUMN_VALUE) = p_value;
RETURN v_count;
END MATCH_PATTERN;
SHOW ERRORS
COMMIT
/the query
SELECT FIELD_ID
, FIELD_PATH
, ERRINDEX
, FIELD_VALUE
FROM (
SELECT a.FIELD_ID
, a.FIELD_PATH
, b.PATTERNS
, CASE
WHEN ((b.MIN_STR_LEN IS NOT NULL) AND ((a.FIELD_VALUE IS NULL) OR (LENGTH(a.FIELD_VALUE) < b.MIN_STR_LEN))) THEN 1
END AS ERRINDEX_1
, CASE
WHEN ((b.MAX_STR_LEN IS NOT NULL) AND ((a.FIELD_VALUE IS NULL) OR (LENGTH(a.FIELD_VALUE) > b.MAX_STR_LEN))) THEN 2
END AS ERRINDEX_2
, CASE
WHEN ((b.PATTERNS IS NOT EMPTY) AND ((SELECT COUNT(*) FROM TABLE(b.PATTERNS) WHERE REGEXP_SUBSTR(a.FIELD_VALUE, COLUMN_VALUE) = a.FIELD_VALUE) = 0)) THEN 4
END AS ERRINDEX_4
, a.FIELD_VALUE
FROM TESTER.PARENT_TABLE a
INNER JOIN TESTER.CHILD_TABLE b ON a.FIELD_PATH = b.FIELD_PATH
UNPIVOT
ERRINDEX
FOR COL IN (ERRINDEX_1, ERRINDEX_2, ERRINDEX_4)
)gives me ORA-03113: end-of-file on communication channel
If on the other hand, I replace the nested single-row SELECT with the function call like this
SELECT FIELD_ID
, FIELD_PATH
, ERRINDEX
, FIELD_VALUE
FROM (
SELECT a.FIELD_ID
, a.FIELD_PATH
, b.PATTERNS
, CASE
WHEN ((b.MIN_STR_LEN IS NOT NULL) AND ((a.FIELD_VALUE IS NULL) OR (LENGTH(a.FIELD_VALUE) < b.MIN_STR_LEN))) THEN 1
END AS ERRINDEX_1
, CASE
WHEN ((b.MAX_STR_LEN IS NOT NULL) AND ((a.FIELD_VALUE IS NULL) OR (LENGTH(a.FIELD_VALUE) > b.MAX_STR_LEN))) THEN 2
END AS ERRINDEX_2
, CASE
WHEN ((b.PATTERNS IS NOT EMPTY) AND (TESTER.MATCH_PATTERN(a.FIELD_VALUE, b.PATTERNS) = 0)) THEN 4
END AS ERRINDEX_4
, a.FIELD_VALUE
FROM TESTER.PARENT_TABLE a
INNER JOIN TESTER.CHILD_TABLE b ON a.FIELD_PATH = b.FIELD_PATH
UNPIVOT
ERRINDEX
FOR COL IN (ERRINDEX_1, ERRINDEX_2, ERRINDEX_4)
)the query gives the correct results which should be
FIELD_ID FIELD_PATH ERRINDEX FIELD_VALUE
6 /A/B 4 20090229
3 /A/C 4 2167
5 /A/D 4 XS10
8 /A/D 2 TESTEDIs there a way to do this without the PL/SQL function call and at the same time avoid the ORA-03113 ? Or, have I hit a bug on 11.1.0.7 ?
Many thanks in advance
Best Regards
PhilipI found the Oracle Bug on my own in the end, in the most unlikely of places !
The following code
SELECT FIELD_ID
, FIELD_PATH
, ERRINDEX
, FIELD_VALUE
FROM (
SELECT a.FIELD_ID
, a.FIELD_PATH
, CASE
WHEN ((b.MIN_STR_LEN IS NOT NULL) AND ((a.FIELD_VALUE IS NULL) OR (LENGTH(a.FIELD_VALUE) < b.MIN_STR_LEN))) THEN 1
END AS ERRINDEX_1
, CASE
WHEN ((b.MAX_STR_LEN IS NOT NULL) AND ((a.FIELD_VALUE IS NULL) OR (LENGTH(a.FIELD_VALUE) > b.MAX_STR_LEN))) THEN 2
END AS ERRINDEX_2
, CASE
WHEN ((b.PATTERNS IS NOT EMPTY) AND ((SELECT COUNT(*) FROM TABLE(b.PATTERNS) WHERE REGEXP_SUBSTR(a.FIELD_VALUE, COLUMN_VALUE) = a.FIELD_VALUE) = 0)) THEN 4
END AS ERRINDEX_4
, a.FIELD_VALUE
FROM TESTER.PARENT_TABLE a, TESTER.CHILD_TABLE b
WHERE a.FIELD_PATH = b.FIELD_PATH
UNPIVOT
ERRINDEX
FOR COL IN (ERRINDEX_1, ERRINDEX_2, ERRINDEX_4)
)works as intended i.e. like a charm !
The only difference between the one that gives the ORA-03113 and the above is the way the join is written. The ANSI way (INNER JOIN) fails, the old way (WHERE clause) succeeds.
I will open a SR with Oracle so that it may be recorded and fixed.
Best Regards
Philip -
Returning multiple function calls as one
Hi,
Lets say I have a function f() which returns a cursor. f() is called via jdbc and the results processed as a resultset.
I would like to know if it is possible to construct a second function, g() which contains 2 calls to f() such that a single cursor is returned (which translates to a concatenated result set from the 2 calls to f)
Any info appreciated, many thanks,
danIt is in general not a good idea to attempt to perform this union of two cursors.
What about issues such as dealing with different number of columns? Different data types? Or sort order?
The sensible approach says that one deals with all this at SQL level. In other words, before you get to the application programming (PL/SQL or Java) level. It is very inefficient to attempt to do the SQL Engine's job at application level. You need to re-invent a lot of wheels. And none of these will turn as fast as the SQL wheels, and nor will the self-rolled wheels have shiny mags. ;-)
Why cannot function F() simply return a cursor that is a pointer to a parsed SQL statement that does the union of the two SQL statements you have in mind?
Why not add a parameter to function F() to tell it whether you want result 1, result 2, or a combination of both?
As for whether it can be done.. yes, it can be hacked. But it will not be performant. It will waste a lot of expensive server memory that can be put to far better use.
One method to do this is to create a pipelined table function called G(). Both ref cursor pointers are passed to G(). G() fetches a row from a cursor, and then simply pipe that row as a result. It iterates through both cursors.
To use G() you will need to call it via the SQL Engine. The major problem with this is that you are now doing double the amount of I/O to get to the results. G() duplicates all the I/O.
As G() runs in the PL/SQL engine, and the cursor pointers refers to data to be fetched using the SQL Engine, a lot of context switching (and pushing data from one stack to another) needs to be done.
So not only will this blow I/O, but also increase CPU.
So the question is why go to all this trouble? Surely it makes a lot more sense to stick to fundamentals - use SQL as it has been designed to use. Use ref cursors for the purpose they have been designed. -
Using transactions in a scenario where multiple function calls are involved
I have a scenario and was contemplating on how to implement transactions.
I have a method A in the BO that calls the main functionB that updates the DB. This second function B inturn calls other functions.
Each of these functions have their own connection objects. I was thinking how to implement transactions in this scenario.
Thanks,
SreeI have a scenario and was contemplating on how to
implement transactions.
I have a method A in the BO that calls the main
functionB that updates the DB. This second function B
inturn calls other functions.
Each of these functions have their own connection
objects. I was thinking how to implement transactions
in this scenario.That's the problem: "Each of these functions have their own connection objects".
Either you'll need to use XA drivers and JTA two-phase commit or have a single Connection that is instantiated by the service that knows about the unit of work and passes it around to all the interested parties.
I'd recommend one Connection to be passed around.
% -
How to avoid multiple call to function:
In our datawarehouse we have a huge receipt row table where all metrics ar stored in the local currency. On top over that we have views which calculate metrics to the desired currency.
So basically all views looks like this
select geo_region,
product_group,
customer_group,
metric1 * (select get_exchange_rate(currency_id) from dual) metric1,
metric1 * (select get_exchange_rate(currency_id) from dual) metric2,
metric1 * (select get_exchange_rate(currency_id) from dual) metricx,
group by..
As we have about 20 metrics we notices that the function is called 20 times per row.
Is there really anyway to avoid that? Shouldn't it be it's just the exact same call with the same in-parameters over and over again.
We've tried with local sys_context and the performance is better but the call to the context is still performed 20 times. Any Ideas?Can you avoid multiple function calls? Maybe, if as in your example all the function calls values are computing the same result. If they operate on different columns then you'll have to perform the function call anyway.
Either way you should be able to eliminate the (near as I can tell) pointless subquery from dual
You might be able to avoid the repeated function calls if the values are always the same. If every computation you could save the function call (and subquery!) by doing it once and then using assignments after the initial query using variables after the initial query, perhaps using NULL in the query as placeholders to select into a record - something like
select inital_region,
product_group,
customer_group,
metric1 * exchange_rate(currency_id) metric1,
null metric2,
v_metric2 := metric1;
...Message was edited by (fixed typo):
riedelme -
Problem using function call in WHERE part of a Report's SQL query
I tried doing some searches on this, but couldn't find anything. I'm trying to run something similar to the following query in my report, but keep getting a "Query cannot be parsed within the Builder" error:
SELECT function1(TABLE2.ID) A
FROM TABLE1, TABLE2
WHERE TABLE1.ID = TABLE2.ID AND
TABLE1.NAME = 'BLAH' AND
TABLE2.DATE > SYSTIMESTAMP AND
(function2(TABLE2.ID) = 'YES' OR
function3(:USER_ID) = 'YES')
ORDER BY TABLE1.NAMEWhy won't this work? I can take out the 2 lines with function calls from the WHERE clause, and it works, so I'm assuming that APEX doesn't like something about my function calls. I know the functions are valid and work properly, because I tested them independently. Can anyone see what the problem is? Thanks!Here's the actual query:
SELECT BUILD_EXT_RES_LIST(EXT_FILE.ID) A
FROM EXT_FILE_RES, EXT_FILE
WHERE EXT_FILE_RES.ON_OWNER_PROFILE = 'Y' AND
EXT_FILE.OWNER_ID = :PROFILE AND
EXT_FILE.ID = EXT_FILE_RES.EXT_ID AND
(RES_SUBSCRIBER_YN(EXT_FILE.ID,:CURR_ID) = 'YES' OR
ADMINYESNO(:CURR_ID,:PROFILE) = 'YES')
ORDER BY EXT_FILE.FILE_NAMEAnd here's the actual error message:
1 error has occurred
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00904: "SER_IS_ADMINYESNO": invalid identifier -
Function Call returning old SQL Query
Hello All,
I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. Inside this function, once the SQL is built, I am inserting this SQL into a log table, for logging purpose.
Note: my function has only one parameter which is a string. This string accepts a name:value pairs with a delimiter which I breakdown inside the function. But this functionality is working fine.
Issue:
When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
</code>
When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
</code>
When I open the logs, I see the SQL being built is the earlier one.
As a test I closed the session and ran (Age = 20, Gender = F) first. It works fine. When I run a different parameter string, it always mimics the earlier function call.
Is CACHING in play here. I tried both the following:
<code> dbms_result_cache.bypass(FALSE);
dbms_result_cache.flush;
</code>
I tried multiple tests, with different parameters and only the first one runs fine and second one copied the earlier. However, when I open two sessions on two different windows it doesn't happen.
Also, in the Logging table I am capturing the input string as a confirmation, which is coming correctly. But the SQL being build mimics the earlier call.
I tried to set the variable which hold the SQL Statement to empty (v_sql := '';) at the beginning and also at the end. Still no use.
Kindly help if I am over looking anything.
Regards,
AjAj09 wrote:
I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. The LONG data type has been replaced by the LOB data type. Oracle specifically recommends not using the old LONG data type.
Issue:
When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
</code>
When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
<code>SELECT * FROM TABLE (
PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
</code>The tag is ** - not *<code>*.
Why a pipeline function? Why dynamic SQL? Are you using +DBMS_SQL+ to create the dynamic cursor? If not, why not? Only +DBMS_SQL+ allows dynamic binding in PL/SQL. Without that, your code will burn a lot of additional CPU on hard parsing and trash and fragment Shared Pool memory.
When I open the logs, I see the SQL being built is the earlier one.
How do you record the current SQL? Are you using a static variable to capture the SQL statement generated?
From what you have described - this is yet another horribly flawed approach in all respects. To data modelling. To relational databases. To Oracle. To SQL.
Reinventing the SQL language for data retrieval as a pipeline function using a funky parameter interface - sorry, I just don't get that. It is an insane approach. -
Put SQL query in a function/ call function from region
How can I write a SQL query (like SELECT EMPNO, ENAME, JOB FROM EMP) as PL/SQL function, and then call this function from the PL/SQL Function Returning SQL Statement region?
Thanks, Tomthanks jverd for your quick reply.
I know passing in a reference to an object will do the job if I want to change the value several parameters in one function call.
But I want to ask, is there any other ways?
the following code works.....
public class TestParameter {
public static void main(String[] args) {
Test2 t2 = new Test2();
invokeChange(t2);
System.out.println("x = " + t2.x + "\t y = " + t2.y);
static void invokeChange(Test2 t2) {
t2.x = 10;
t2.y = 15;
class Test2 {
int x;
int y;
} -
IS IT POSSIBLE TO CALL FUNCTION IN sap QUERY sq01
IS IT POSSIBLE TO CALL FUNCTION IN sap QUERY sq01
Use enhancement project SQUE0001 for background downloads of query data. Use the 'Private File' option with the query execution.
-
Avoid procedure or function calls between a SQL operation and an implicit cursor test
when i analyse this code with code expert
atpidgeon wrote:
when i analyse this code with code expert
UPDATE P_PM_CONTROL_COUNT
SET AVAIL_SEG = AVAIL_SEG -1,
ALLOCATION = ALLOCATION -1
WHERE PM_UNIT_TYPE_ID = vrectab(1)
AND USAGE_DATE = vrectab(2)
AND SEGMENT_CODE = vrectab(5)
AND ALLOCATION - UNITS_RESERVED > 0;
IF sql%rowcount = 0 then --Added block and exception to prevent invetory going negative when placing multi units in same unit type out of service.
vErrMsg := 'Could not process your out of service request because your selection for unit '|| vrectab(3) || ' at ' || pvPropertyId || ' for ' || vrectab(2) || ' would cause segment ' || vrectab(5) || ' to be over allocated.';
RAISE SegOverAllocated;
END IF;
i get "Avoid procedure or function calls between a SQL operation and an implicit cursor test.",as far has i know
iff you're doing a sql%rowcount after an update.. trying to see how many rows were updated... you dont want procedure or function calls between the update and the sql% line
correct me if im wrong and how would i fix it?or maybe i shouldnt
You correct it by NOT executing function calls as part of the UPDATE statement.
1. Issue the function calls BEFORE the update statement
2. save the function results into variables
3. use those variables in the UPDATE statement.
v_rectab1 := vrectab(1);
v_rectab2 := vrectab(21);
v_rectab5 := vrectab(5);
UPDATE P_PM_CONTROL_COUNT
SET AVAIL_SEG = AVAIL_SEG -1,
ALLOCATION = ALLOCATION -1
WHERE PM_UNIT_TYPE_ID = v_rectab1
AND USAGE_DATE = v_rectab2
AND SEGMENT_CODE = v_rectab5
AND ALLOCATION - UNITS_RESERVED > 0; -
Query: how to avoid multiple POs from being combined into delivery
Hi all,
We are working on an enhancement.
The requirement is:
We need to avoid multiple POs from being combined into one delivery.
Any pointers in this regard would be highly appreciated.
regards
GurpreetHi Murali,
I think your suggestion should solve Gurpreets problem.
I have a query here.
In the copy controls VLTA, defines between sales doc to dlivery doc.
Here we want to maintain copy control between purchasing doc to delivery doc.
How do we achive this?
Also in my view we should write a new combination requirement.
Please check if combination requirement 51 can be used?
Regards
Abhishek -
RFC Assign Link As XML Multiple Input Error SAP JRA Function Call
I am using SAP MII 12.1.0 (Build 201)
I have a problem with SAP JRA Function Call Action in Link Assignment as assign XML.
I need to assign multiple input but from local xml property to my RFC table as assign XML
but when i am going to execute my transaction i am getting following errors.
[WARN] Data buffer filter for this action does not exist or the interface is incorrect.
[ERROR] Unable to make RFC call Exception: [com.sap.conn.jco.JCoException: (104) RFC_ERROR_SYSTEM_FAILURE: Transferred IDoc data records are empty (internal error) ]
[WARN] [SAP_JRA_Function_Upload_Material_Consumption] Skipping execution of output links due to action failure.
[ERROR] [UserEvent] : com.sap.conn.jco.JCoException: (104) RFC_ERROR_SYSTEM_FAILURE: Transferred IDoc data records are empty (internal error)
Please help me out in this issue.
Regards,
Manoj BilthareDear Jeremy
Thanks for reply
My Problem is got solved that problem is due to version problem now the MII version is Version 12.1.4 Build(46).
Regards,
Manoj Bilthare -
One script to make multiple cells call one function or vice versa
Please help.
I need one script to make multiple cells reference one function or one cell reference multiple functions.
Goal: On the enter event of cell c1, I want to make cells (this, Header.c1, Example.c1, rLabel) highlighted, and this would be for every other cell that is entered into, their corresponding column header and row header will be highlighted.
I've tried combining cells: eg
colourControls.hdfieldLoseFocus(this, HeaderRow.c1, Example.c1, rLabel);
and I've also tried combining some scripts in the function:
fieldObj.ui.oneOfChild.border.fill.color.value = "255,255,200";
HeaderRow.fieldObj.ui.oneOfChild.border.fill.color.value = "255,255,200";
ExampleRow.fieldObj.ui.oneOfChild.border.fill.color.value = "255,255,200";
But they dont work. See the link to my form.
http://www.winstonanddavid.com/example.com
I tried testing the function with the cell 'c1' but it doesnt work.
Also, I want to get rid of the multiple lines of script in every other cell.
How can I do this?I played around with the ExtendScript Toolkit and cutted and pasted the previous script from here until I managed to get a script that actually works like I was thinking. I then added a code from the CS4 Reference Manual to move Layer1 to the top (just to see if it worked).
I have no idea yet if the the code includes something that does not belong, but at least I get no errors. The current code is like this now:
//Apply to myDoc the active document
var layerName = LayerOrderType;
var myDoc = app.activeDocument;
//define first character and how many layers do you need
var layerName
var numberOfLayers=0;
//Create the layers
for(var i=0; i<=numberOfLayers; i++)
{ var layerName = "Background"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = "Picture"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = "Text"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = "Guides"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
// Moves the bottom layer to become the topmost layer
if (documents.length > 0) {
countOfLayers = activeDocument.layers.length;
if (countOfLayers > 1) {
bottomLayer = activeDocument.layers[countOfLayers-1];
bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
else {
alert("The active document only has only 1 layer") -
How to avoid a function module runnning parallely twice
Hello,
There is a scenario, where user calls a function module via RFC.
The requirement is to avoid the user from running the function module parallely twice or more because it may lead to dead lock problems.
To realize this creation of a new enqueue object and set up of enqueue of this object in the function is suggested.
If the object is blocked (which means the function is already being
running by the sorter), it should go out of the function.
Can i get help in locking this function module during execution.
With Best Regards,
Adarsh.Here's a sample of how you might do this - see comments in code for explanation.. run the program in two differ SAPGui sessions to see the effect.
report zlocal_jc_tfdir_lock.
start-of-selection.
perform set_and_check_lock.
form set_and_check_lock.
*" Use SAP enqueue to prevent multiple RFC calls of same object
data:
l_object like tfdir-funcname.
*" Build some name that is specific to your needs
*" Include sy-uname in key if lock is per user, not for process
concatenate '#Z LOCK:' sy-uname into l_object.
*" and enqueue
call function 'ENQUEUE_ESFUNCTION'
exporting
funcname = l_object
exceptions
foreign_lock = 1
system_failure = 2
others = 3.
if not sy-subrc is initial.
message e398(00)
with
l_object 'is held by' sy-msgv1 space.
else.
write: / l_object, 'is now locked - check sm12 for proof'.
endif.
endform. -
Help with multiple httpservice calls
I need help with multiple httpservice call back to back, doing 10 different mysql query at startup of the app loading results into 14 datagrids/combobox all queries are to different tables.
Hello,
I think what Grizzzzzzzzzz means is the following:
<mx:HTTPService id="serviceOne"
url="here goes url"
result="resultHandler1(event);"
fault="faultHandler(event);"/>
<mx:HTTPService id="serviceTwo"
url="here goes url"
result="resultHandler2(event);"
fault="faultHandler(event);"/>
<mx:HTTPService id="serviceThree"
url="here goes url"
result="resultHandler3(event);"
fault="faultHandler(event);"/>
// Result handler 1
private function resultHandler1(event:ResultEvent):void{
//Here do something with the results
xmlCollection = event.result as XML;
//then call the next service
serviceTwo.send();
// Result handler 2
private function resultHandler2(event:ResultEvent):void{
//Here do something with the results
xmlCollection = event.result as XML;
//then call the next service
serviceThree.send();
I hope this helps,
Pierre
Maybe you are looking for
-
I can no longer login to my Macbook Pro.
Hello everybody, I am the owner of a Macbook Pro (bought it in 2010) with the newest Maverick software. There was an new update to be done (I don't really know which one), which went without problems. Afterwards I wanted to open mail, but I got a not
-
Price of Item appears for Return of Sample Orders
Hi, I am creating a sample order with price of item as Zero using Item category KLN. Goods are delivered and also Invoiced with Zero amount. Now when i create Return with reference to Invoice i am getting the net price of the item, but i want this am
-
I am running 10.7.5 on an imac and I want to upgrade to Yosemite but I have no app store on my computer. Is there a way I can get the app store on my imac?
-
HT5654 My I pad stopped working it is stuck in gmail
My I pad is stuck in gmail I cannot access emails. What can I do
-
REALLY fast stop motion..HELP!
So I am trying to make a stop motion using imovie 09 and it wont let me make the clips shorter then .1 seconds...does anybody know how I can make them shorter? I am trying to make this REALLY fast...Help!! This is for a major film project I am workin