Latest Value Function
I'm trying to create a spreadsheet with a footer row that will contain the latest value entered (like in the Weight Tracker template's Most Recent Weight cell), but I can't figure which functions to use. Any help? Thanks so much!
lobbyart wrote:
Except it doesn't work... I just get errors. I've tried over and over to plug in equivalent cells to the formula on the template, but no combination is correct. If it were that simple, I wouldn't have come on here for advice.
la,
Coming here for advice works best if you are willing to patiently and completely describe your situation and enter into a dialog with the volunteer helpers.
I'm glad you found an answer, but as Barry noted, you haven't done any favors for others who may come here looking for answers to similar problems.
Jerry
Similar Messages
-
Hi,
I am creating a report with Client have some numbers for year and month basis. I am showing this in a Cross tab. User want to see the latest value also in a seperate Column as latest and it should be the last month shown in cross tab.
Attached is something I am looking for .
I am using BO 3.1
I am not able to find any way how to do that. If someone can help me.
Thanks.you can use Last function in a footer column.
syntax: =Last([Measure Object]) -
Latest Value - Select Option - At Selection Value help
Hi,
I need the current values entered in the Select Option of the Selection Screen while generating the Value Help.
There are two selection option fields in the Selection Screen, Selopt1 and Selopt2, to generate the Value help of Selopt2 i need the latest values of the Selopt1, the function module dynp_read_values does not return all the values of the selectop option Selopt1 it returns only the first row of selopt1-high and selopt1-low, the function module RS_REFRESH_FROM_SELECTOPTIONS does not return the current values entered in the selection screen, is there any way to retrive the latest values of the select option in the event At Selection Screen on Value Request.
regards
SantoshHi Santosh,
When you go for f4 help on selopt2, you can use following code to get the current value of selopt1,
AT SELECTION-SCREEN ON VALUE-REQUEST
FOR selopt2-high.
select * from bkpf into table it_bkpf where
BKTXT in selopt1[].
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BKTXT'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'Invoice Id'
value_org = 'S'
TABLES
value_tab = it_bkpf .
IF sy-subrc <> 0.
" do nothing.
ENDIF.
In selection screen, you can directly fetch the value of selection options or parameters by selopt1 or selopt2 (in your case by using AT Selection Screen for value request).
Reply for further doubts,
Please reward if useful.
Thanks and regards,
Ashlesha Desai
Edited by: ashlesha desai on May 26, 2008 6:06 AM -
Need SQL to update Column based on latest value
EFF_DTE EXCH_FROM_CTRY_CD EXCH_TO_CTRY_CD SECTY_LST_PRCE SECTY_MTH_AVG_PRCE New Col In View
1/1/2013 USD MXN 12.988 12.988 12.88672
1/2/2013 USD MXN 12.988 12.988 12.88672
1/3/2013 USD MXN 12.9658 12.9806 12.88672
1/4/2013 USD MXN 12.7488 12.92265 12.88672
1/5/2013 USD MXN 12.743 12.88672 12.88672
I have above table and I need to populate New Col using view. New Column value should be Latest date SECTY_MTH_AVG_PRCE . For example If today date is 1/5/2013 date New Col should populate value 12.88672 for all the records for that month only. So every day when new MTH AVG Rate come then it should populate latest value of Secty_MTH_AVG_PRCE to New Col.
The New Col should populate with latest Avg_Prc only for that month. If New Month Start then new col should now update all records value but It should update only for June month Only.
Please help me to make a view query. and let me know if any query?
Thanks in advance.Hi,
This sounds like a job for the analytic FIRST_VALUE function:
MERGE INTO table_x dst
USING (
SELECT eff_dte
, FIRST_VALUE (secty_mth_avg_price)
OVER (
PARTITION BY exch_from_ctry_cd, exch_to_ctry_cd -- Maybe
ORDER BY eff_dte DESC
) AS new_col
FROM table_x
WHERE eff_dte >= TRUNC (SYSDATE, 'MONTH')
AND eff_dte < ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), 1)
) src
ON ( dst.eff_dte = src.eff_dte
AND dst.exch_from_ctry_cd = src.exch_from_ctry_cd -- Maybe
AND dst.exch_to_ctry_cd = src.exch_to_ctry_cd -- Maybe
WHEN MATCHED THEN UPDATE
SET dst.new_col = src.new_col
;I'm just guessing at lots of things, because the question is so unclear.
Is there a view involved in this problem, as well as the table? What role, if any, do exch_from_ctry_cd and exch_to_ctry_cd play in this problem. When you say "June", do you mean "February"?
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data. Make sure that no column is the same for all rows in the sample data. (E.g., have a least 2 distinct values for exch_to_ctry_cd.)
If you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
Problem with dg4msql and table-valued functions
Have configured dg4msql to connect from my oracle db to ms sql server.
Am able to do simple SELECTs from ms sql tables like:
select * from "sys"."procedures"@dg4msql;
or
select * from "dbo"."SomeTable"@dg4msql;
But am unable to do a SELECT from a table-valued function:
select * from "dbo"."GetData"@dg4msql('param1value');
or
select * from "dbo"."GetData"('param1value')@dg4msql;
In both cases I get:
ORA-00933: SQL command not properly ended
It does not like the parameters portion of the query ("('param1value')")
initdg4msql.ora:
HS_FDS_CONNECT_INFO=[svr1]//mydb
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_PROC_IS_FUNCT=TRUE
HS_FDS_RESULTSET_SUPPORT=TRUE
Have tried the other set of params:
HS_FDS_PROC_IS_FUNCT=FALSE
HS_FDS_RESULTSET_SUPPORT=TRUE
Same story. After changing the init*** file have bounced both Listeners (DB and Gateway), reconnected, and re-run the query.
Have I missed something?
Any help is greatly appreciated!Sorry, but for me it looks you did not get the problem.
Oracle® Database Gateway for SQL Server User's Guide,:
11g Release 2 (11.2)
Part Number E12069-02
*2 SQL Server Gateway Features and Restriction*
Result Sets and Stored Procedures
The Oracle Database Gateway for SQL Server provides support for stored procedures which return result sets.
By default, all stored procedures and functions do not return a result set to the user. To enable result sets, set the HS_FDS_RESULTSET_SUPPORT parameter value to TRUE.
PL/SQL Program Fetching from Result Sets in Sequential Mode
-- Execute procedure
out_arg := null;
refcurproc@MSQL('Hello World', out_arg, rc1);
Somewhere in this forum I've seen a message that the syntax "SELECT ... FROM sp@db(param1, param2)" works.
Anyway, even with the PL/SQL block the error message is the same - ORA-00933 "SQL command not properly ended"
and the cursor (* in SQL*PLUS) is put just at the first bracket.
Edited by: user636213 on Aug 10, 2012 5:17 AM -
Error when executing a scenario based on Variable type Latest Value
Hi,
I have created two ODI varaible -
1) filename of type as "Historize"
2) id of type as "Historize"
I have 2 Models -
1) One is based on FIle Technology with resource name as #CUSTOMER.filename (dynamic filename) (TARGET)
2) second is based on Oracle technology which contains two relational tables (SOURCE)
I have an interface in which one-to-one mapping is done from source to target.
At the junction of two source tables..i have put a query as "CUSTOMER_PAYMENT.CUSTID=CUSTOMER_DETAILS.CUSTID and CUSTOMER_DETAILS.CUSTID !=(#id)"
Package:
drag and drop two ODI variables , interface
Connect two ODI variable to interface and define the variable type as "Declare Variable" in the package.
Define filename as the firststep.
filename(firststep)-----------------------------
INTERFACE
id---------------------------------------------------
It is working fine with java callout and command prompt. It is not working when i invoke it on desginer.
It gives me error:
java.sql.SQLException: ORA-00936: missing expression
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:503)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:965)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:535)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1051)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3026)
at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
Similary when i define the variable type as "Latest Value/Niot Persistent"...giving me same error as above...but working finw with java and command prompt.
Thanks
Edited by: user12420305 on Aug 31, 2010 10:42 PMHi,
My Package contains:
First step : customerid and custFileName
Second step : interface
Type of both the variables in package is "Declare"
customerid : type Alphanumeric - Historize
custFileName : type Alphanumeric - Historize
generate a scenario of the package and execute it.
custFileName : abc.txt customerid : 2
The file is created but it is giving me error for customer id.
Operator Description:
select
CUSTOMER_DETAILS.CUSTID CUSTOMER_ID,
CUSTOMER_DETAILS.LAST_NAME || CUSTOMER_DETAILS.FIRST_NAME CUSTOMERNAME,
CUSTOMER_DETAILS.ADDRESS ADDRESS,
CUSTOMER_PAYMENT.PAYMENTID PAYMENT_ID,
CUSTOMER_PAYMENT.AMOUNT AMOUNT
from ODITEST1.CUSTOMER_DETAILS CUSTOMER_DETAILS, ODITEST1.CUSTOMER_PAYMENT CUSTOMER_PAYMENT
where (1=1)
And (CUSTOMER_PAYMENT.CUSTID=CUSTOMER_DETAILS.CUSTID and CUSTOMER_DETAILS.CUSTID !=(#CUSTOMER.customerid))
Operator Execution:
936 : 42000 : java.sql.SQLException: ORA-00936: missing expression
java.sql.SQLException: ORA-00936: missing expression
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:503)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:965)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:535)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1051)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3026)
at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
When i try to execute the scenario from command promt/java callout ..it is working fine.
Thanks. -
In which condition Table valued function should prefer over SP except use in joins?
Hi,
My requirements is:
Entity framework needs to call DB object (TVF or SP), which will provide some data to them and they'll work on it at app level.
DB object would be simple, one result set, it will join 5 tables and get around 30 columns to them. it would be parameterized query so can't use view.
Now my question is what DB object would be best to use, table valued function or store procedure. and why?
I google on it, I find some interesting links (example http://technet.microsoft.com/en-us/library/ms187650(v=sql.105).aspx)
they mentioned conditions to convert SP to TVF but not mentioned the reason, why I should convert?
Both have same cache plans strategy. SP has so many advantages over TVF, but I don't see any technical advantage of TVF over SP except it can be use in joins or so.
so In short my question is, why I can't use SP in all cases, why I would use TVF?, and which Table valued or multi-valued?
would appreciate your time and response.According to a few recent blogs you should be able to use TVP or stored procedure with EF 6.1.2 with ease. In our application we haven't switched yet to 6.1.2 (we're using 6.0.0) and there is no support for stored procedures or functions so we use StoreQuery.
I am wondering if you can share your experience of using EF with SP or TVP (and document the steps).
I am also wondering as how exactly it's working behind the scenes and where the full query is taking place. Say, in our case we may want to add some extra conditions after retrieving a set using, say, SP. Would the final query execute on the client (e.g.
SP executed on the server, result returned and then extra conditions executed on the "client")?
As I said, right now we're using StoreQuery which means that our extra conditions must be case - sensitive as opposed to SQL Server case insensitive. So, if someone already tried that scenario and can tell me how exactly it works, I would appreciate it.
Another question about EF - I defined a property as
[Column(TypeName = "varchar")]
public string PhoneNumber { get; set; } // area code + phone
and in the LINQ query as
var query = db.Accounts.Select(a => new AccountsList
AcctName = a.AcctName,
Contact = a.Contact,
FullName = a.FullName,
AreaCode = a.AreaCode,
Phone = a.Phone,
Hidden = a.Hide,
Hide = a.Hide,
PhoneNumber = a.AreaCode.Trim() + a.Phone.Trim(),
AcctTypeId = a.AcctTypeId
and I see that it's translated into CASE AreaCode IS NULL THEN N'' ELSE RTRIM(LTRIM(areaCode)) END + ...
My question is - why EF does it if there is no mentioning at all in the class as how NULL is supposed to be treated. Is it a bug?
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
JDBC Adapter Call a Table-Valued Function
Hello to all,
we're using the JDBC adapter to access a MS SQL-Server 2008.
I have to call a "Table-Valued Function" via JDBC.
Has anybody done this?
I've tried to call it like a stored procedure with the following:
<ns1:LGBuchungSAP_REQ xmlns:ns1="http://xyz.de/pi/mav/kantine">
<fLGBuchungenSAP>
<Tablename action="execute">
<table>dbo.fLGBuchungenSAP</table>
</Tablename>
</fLGBuchungenSAP>
</ns1:LGBuchungSAP_REQ>
but I get following error:
com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser:
Error when executing statement for table/stored proc. 'dbo.fLGBuchungenSAP' (structure 'fLGBuchungenSAP'): com.microsoft.sqlserver.jdbc.SQLServerException:
Fehler bei der Anforderung für 'fLGBuchungenSAP' (Prozedur), weil 'fLGBuchungenSAP' ein Tabellenwertfunktion-Objekt ist.
Calling with a select-statement also fails:
<ns1:LGBuchungSAP_REQ xmlns:ns1="http://xyz.de/pi/mav/kantine">
<STATEMENT_NAME>
<Tablename action="SELECT">
<table>dbo.fLGBuchungenSAP('20101101 00:00:00', '20110101 00:00:00')</table>
</Tablename>
</STATEMENT_NAME>
</ns1:LGBuchungSAP_REQ>
with error:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Eingangs-Message -->
<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1></SAP:P1>
<SAP:P2></SAP:P2>
<SAP:P3></SAP:P3>
<SAP:P4></SAP:P4>
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'dbo.fLGBuchungenSAP('20101101 00:00:00', '20110101 00:00:00')' (structure 'STATEMENT_NAME'): java.lang.IndexOutOfBoundsException: Index: 4, Size: 4</SAP:AdditionalText>
<SAP:Stack></SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Please advice
Regards
ChristianHello to all,
I solved the problem.
You have to call it this way:
<ns1:LGBuchungSAP_REQ xmlns:ns1="http://xyzde/pi/mav/kantine">
<STATEMENT>
<LGBuchungSAP action="SQL_DML">
<access>select * from dbo.fLGBuchungenSAP('$DatumVon$', '$DatumBis$')</access>
<key>
<DatumVon>20101101 00:00:00</DatumVon>
<DatumBis>20110101 00:00:00</DatumBis>
</key>
</LGBuchungSAP>
</STATEMENT>
</ns1:LGBuchungSAP_REQ>
But I get the next error: "A result set was generated for the update task"
<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1></SAP:P1>
<SAP:P2></SAP:P2>
<SAP:P3></SAP:P3>
<SAP:P4></SAP:P4>
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'LGBuchungSAP' (structure 'STATEMENT'): com.microsoft.sqlserver.jdbc.SQLServerException: Es wurde ein Resultset für den Aktualisierungsvorgang generiert.</SAP:AdditionalText>
<SAP:Stack></SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error> -
How to declare variable in table valued function
hello.
i have the following code to define a inline table valued function
but the use of cmn.ReshteId('Lf_WL') as a function in where clause is not good performance.
Alter function lf.fn_WholeLifeBn_GetForm(@ViewKind tinyint, @CurrentLocation int) returns table
as
return
select B.*
from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
where Reshte = cmn.ReshteId('Lf_WL')
for better performance following code is good:
declare @Reshte smallint
set @Reshte = cmn.ReshteId('Lf_TS')
select B.*
from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
where Reshte = @Reshte
but can not use it as the first code block in inline function.
please help for define a good function.What do you think about Multi-Statement Table-Valued UDFs?
create function Func(@Var int)
returns @T table(ColName int)
as
begin
insert into @T(ColName) values (@Var)
return
end
select * from Func(10)
select * from Func(20)
---or
alter function Func()
returns @T table(ColName int)
as
begin
declare @Var int
set @Var = 10
insert into @T(ColName) values (@Var)
return
end
select * from Func()
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to enforce SCN of a datafile to the latest value?
Hello,
I try to restore old contents of my database on another server. The DB is not (and never was) in ARCHIVELOGMODE, and I have 2 cold backups of it. Neither backup set is complete (due to recycling of old tapes), but I still can restore all datafiles, though to two different SCNs. Out of 38 datafiles, 35 have SCN = 2458610942 and 3 have SCN = 2448133391.
SQL> select checkpoint_change#, count(1) as cnt from v$datafile_header group by checkpoint_change#;
CHECKPOINT_CHANGE# CNT
2448133391 3
2458610942 35
I believe, these 3 datafiles should still have usable contents, and hence would like to open DB as is.
RMAN> recover database;
Starting recover at 04-FEB-13
using channel ORA_DISK_1
using channel ORA_SBT_TAPE_1
starting media recovery
RMAN-08187: WARNING: media recovery until SCN 2448133391 complete
Finished recover at 04-FEB-13
RMAN> alter database open resetlogs;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 02/04/2013 18:17:06
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u01/oradata/GENERIC/system01.dbf'
Of course, there is no archived logs to update these 3 tablespaces.
Can I enforce SCN of these 3 datafiles to the latest value 2458610942? Or should I do something else?
Thanks already for your help!user522816 wrote:
_ALLOW... sounds great! A description, please? docs, blogs...You need to be EXTREMELY AWARE that that parameter is classified as a hidden, udocumented parameter for good reason. If you don't know exactly what you are doing with it, you run a huge risk.
Your question is yet another classic case of focusing on some pre-concieved (and most likely, ill-conceived) solution to some un-stated business problem. If we knew that problem, we could give better advice than the dangerous use of hidden, undocumented parameters. -
I'm trying to create a query where the latest value shows up on my query.
For example, my data looks like the following:
Week Hours
05/2007 1360.0
06/2007 1360.0
07/2007 1440.0
08/2007 1440.0
09/2007 1400.0
If I have a variable on the week and choose a range from 01/2007 through 11/2007, I want the ending hours to show up as 1400.0. Currently, they show up as 0 since I don't have any data for week 11/2007. Any ideas on how I might be able to achieve this?
Any help is greatly appreciated.Hi,
As per my understanding I believe that you need the latest data in the Date range inputted.
You can calculate the value using Formula variable. Populate the Forumula variable in the User exit based on the Date range value.
Thanks & Regards,
Namrata -
Hi All,
I have a questions to ask. Is that i create a subvi for my table and it can display latest value at the top. Below attached snapshots of my programming. I uses a random number and stop button to control to let u guys see the whole process of what i want.
but when i change 'true/false constant' and using a numeric control. and i placed it back to my program. It won't lists down the values and it wont display the latest value at the top. what's the problem? I have been stuck at this problem for awhile.
and another question was how to keep the size of the listing be constant? for example, i onli wish to display 30readings on my table. as the programming kept running, the oldest value will be replace. because if kept running my programming, and the listing on my table getting more and more, means memory increases, result in lagging. I don't wish to happen. So is there a way to maintain the fixed table displaying values?
Solved!
Go to Solution.
Attachments:
table.ex.JPG 38 KB
table.ex1.JPG 41 KB
te1.JPG 98 KBHi Isabella,
I think the problem causes from initializing a shift register in sub vi. If you initialize a shift register, every time sub vi is called, it'll replace value in shift register with initialized value. Uninitialize a shift register should solve a problem. I attached a screenshot of my sub vi for your reference.
Regards, Kate
Attachments:
isabella.PNG 5 KB -
Calling User definedTable valued function in Select
Hello,
I Created a UserDefined Table Valued Function in HANA.
I need to call it in Select Statement Statement.
For Example
Select Func(col1) as test,col2 from tablename;
While using UserDefined Table Valued Function in above select statement
I am getting following error
cannot use procedure or table function in select projection
Please help meDont think you can do that Krishna,
A Tabel UDF is expected to return a row of results and not just a scalar value. A SELECT <value> on the other hand can only expect a single value. Maybe you could try SELECT (SELECT TOP 1 <column name> from TABLEUDF() ) from....
Regards,
Nehal. -
SQL CLR Table-Valued Function System.NullReferenceException
Good day.
I wrote a clr table-valued function that gets the data from the sharepoint list using the client model.
Sometimes I get exception (When I calling this function I get 90000 rows and then I get this exception...):
Msg 6260, Level 16, State 1, Line 1
An error occurred while getting new row from user defined Table Valued Function :
System.NullReferenceException: Object reference not set to an instance of an object. System.NullReferenceException: v at SDS.FillRow(Object obj, SqlInt32& month, SqlString& datePlanSalary, SqlString& dilerCode, SqlString& dilerName, SqlString&
model, SqlInt32& countSalary).
How can I fix this issue?
My Code:
public class SDS
[SqlFunction(SystemDataAccess = SystemDataAccessKind.Read, FillRowMethodName = "FillRow")]
public static IEnumerable SDSItems(SqlString url, SqlString listName)
ClientContext context = new ClientContext(url.ToString());
List list = context.Web.Lists.GetByTitle(listName.ToString());
CamlQuery query = new CamlQuery();
query.ViewXml = "<View/>";
ListItemCollection listItems = list.GetItems(query);
context.Load(list);
context.Load(listItems);
context.ExecuteQuery();
return listItems;
public static void FillRow(
object obj,
out SqlInt32 month,
out SqlString datePlanSalary,
out SqlString dilerCode,
out SqlString dilerName,
out SqlString model,
out SqlInt32 countSalary
item = (ListItem)obj;
month = Convert.ToInt32(item["_x041c__x0435__x0441__x044f__x04"]);
datePlanSalary = Convert.ToString(item["_x0414__x0430__x0442__x0430__x000"]);
dilerCode = Convert.ToString(item["_x041a__x043e__x0434__x0020__x04"]);
dilerName = Convert.ToString(item["_x041d__x0430__x0437__x0432__x04"]);
model = ((FieldLookupValue)item["_x041c__x043e__x0434__x0435__x04"]).LookupValue;
countSalary = Convert.ToInt32(item["_x041a__x043e__x043b__x0438__x04"]);That's not a lot of information to go on, but...
Can you put a check in your FillRow method for a null object (or one of your fields being null) and put out diagnostic information? Or is it happening in the ListItemCollection iterator itself? (i.e. before it returns a row back to FillRow). If it's happening
in the iterator, perhaps you could subclass it and return diagnostics at that point.
I'm also wondering (if it actually always happen at row 90000) if you're hitting a limit in web service call, or iterator, or UDF code. Does the function ever return more than 90000 rows successfully?
Hope this helps, Bob -
SQL: Issue with running out of storage on server when running table-valued function
SQL Version: 2008 (not r2)
Problem: I'm getting the following error message when running a table-valued function:
Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object 'dbo.SORT temporary run storage: 141072001204224' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files
to the filegroup, or setting autogrowth on for existing files in the filegroup.
Request: Could anyone tell me if there are modifications that I could make to my SQL code to avoid this storage issues?
Thanks,
....bob sutor
Code Facts:
The JCCD table is a large table 2MM records
The other tables in the JOINS are very small 15 records or less
SQL Function Code:
ALTER FUNCTION [dbo].[xcft_XAWP_GLBalance_JCCD_Detail]()
RETURNS @JCGLDetail TABLE
JCCo tinyint
, Job varchar(10)
, PostingSource varchar(10)
, CostToDate numeric(12,2)
, Phase varchar(20)
, EarnType smallint
, LiabilityType smallint
, CostType tinyint
, ControllingSetting varchar(30)
, GLAccountCharged varchar(20)
, DeptNum varchar(10)
, DeptDesc varchar(30)
, JCDC_CostType tinyint
, CostTypeGL_Open varchar(20)
, CostTypeGL_Closed varchar(20)
, JCDO_ExcludePR varchar(1)
, JCDO_Phase varchar(20)
, PhaseGL_Open varchar(20)
, PhaseGL_Closed varchar(20)
, JCDL_LiabType smallint
, LiabTypeGL_Open varchar(20)
, LiabTypeGL_Closed varchar(20)
, JCDE_EarnType smallint
, EarnTypeGL_Open varchar(20)
, EarnTypeGL_Closed varchar(20)
AS
BEGIN
DECLARE
@WIPMonthCurrent date
SET @WIPMonthCurrent = (Select TOP 1 WIPMonth FROM udxcWIPMonths WHERE ActiveWIPPeriod = 'Y')
INSERT INTO @JCGLDetail
JCCo
, Job
, PostingSource
, CostToDate
, Phase
, EarnType
, LiabilityType
, CostType
, DeptNum
, DeptDesc
, JCDC_CostType
, CostTypeGL_Open
, CostTypeGL_Closed
, JCDO_ExcludePR
, JCDO_Phase
, PhaseGL_Open
, PhaseGL_Closed
, JCDL_LiabType
, LiabTypeGL_Open
, LiabTypeGL_Closed
, JCDE_EarnType
, EarnTypeGL_Open
, EarnTypeGL_Closed
SELECT
JCCD.JCCo, JCCD.Job, JCCD.Source, sum(JCCD.ActualCost) AS CostToDate, JCCD.Phase, JCCD.EarnType, JCCD.LiabilityType, JCCD.CostType
, JCDM.Department, JCDM.Description
, JCDC.CostType AS JCDC_CostType, JCDC.OpenWIPAcct AS CostTypeGL_Open, JCDC.ClosedExpAcct AS CostTypeGL_Closed
, JCDO.ExcludePR AS JCDO_ExcludePR, JCDO.Phase AS JCDO_Phase, JCDO.OpenWIPAcct AS PhaseGL_Open, JCDO.ClosedExpAcct AS PhaseGL_Closed
, JCDL.LiabType AS JCDL_LiabType, JCDL.OpenBurdenAcct AS LiabTypeGL_Open, JCDL.ClosedBurdenAcct AS LiabTypeGL_Closed
, JCDE.EarnType AS JCDE_EarnType, JCDE.OpenLaborAcct AS EarnTypeGL_Open, JCDE.ClosedLaborAcct AS EarnTypeGL_Closed
FROM JCCD
LEFT JOIN JCJP ON JCCD.JCCo = JCJP.JCCo AND JCCD.Job = JCJP.Job
LEFT JOIN JCCM ON JCJP.JCCo = JCCM.JCCo AND JCJP.Contract = JCCM.Contract
LEFT JOIN JCDM ON JCCM.JCCo = JCDM.JCCo AND JCCM.Department = JCDM.Department
LEFT JOIN JCDC ON JCDM.JCCo = JCDC.JCCo AND JCDM.Department = JCDC.Department AND JCCD.CostType = JCDC.CostType
LEFT JOIN JCDE ON JCDM.JCCo = JCDE.JCCo AND JCDM.Department = JCDE.Department AND JCCD.EarnType = JCDE.EarnType
LEFT JOIN JCDO ON JCDM.JCCo = JCDO.JCCo AND JCDM.Department = JCDO.Department AND JCCD.Phase = JCDO.Phase
LEFT JOIN JCDL ON JCDM.JCCo = JCDL.JCCo AND JCDM.Department = JCDL.Department AND JCCD.LiabilityType = JCDL.LiabType
LEFT JOIN xcft_XAWP_FiscalPeriodCutoffs_ForWIPMonth() AS cutoffs ON JCCD.JCCo = cutoffs.GLCo
WHERE
JCCD.Mth <= cutoffs.FiscalYear_LastMonth
AND JCCD.Job IN(SELECT JobNum FROM budxcWIPData_SQL WHERE WIPMonth = @WIPMonthCurrent)
AND JCCD.JCCo IN(SELECT JCCo FROM JCCO WHERE udExcludeFromWIP <> 'Y' or udExcludeFromWIP IS NULL)
--AND LTRIM(RTRIM(JCCD.Job)) = '71-'
GROUP BY
JCCD.JCCo, JCCD.Job, JCCD.Source, JCCD.Phase, JCCD.EarnType, JCCD.LiabilityType, JCCD.CostType
, JCDM.Department, JCDM.Description
, JCDC.CostType, JCDC.OpenWIPAcct, JCDC.ClosedExpAcct
, JCDO.ExcludePR, JCDO.Phase, JCDO.OpenWIPAcct, JCDO.ClosedExpAcct
, JCDL.LiabType, JCDL.OpenBurdenAcct, JCDL.ClosedBurdenAcct
, JCDE.EarnType, JCDE.OpenLaborAcct, JCDE.ClosedLaborAcct
UPDATE @JCGLDetail
SET
ControllingSetting =
CASE WHEN Phase = JCDO_Phase AND JCDO_ExcludePR = 'N' THEN 'PhaseOverride-PR Excluded'
WHEN Phase = JCDO_Phase AND JCDO_ExcludePR = 'Y'
AND EarnType NOT IN(Select EarnType FROM JCDE WHERE JCDE.JCCo = JCCo AND JCDE.Department = DeptNum)
AND LiabilityType NOT IN(Select LiabType FROM JCDL WHERE JCDL.JCCo = JCCo AND JCDL.Department = DeptNum)
THEN 'PhaseOverride-PR Not Excluded'
WHEN EarnType = JCDE_EarnType THEN 'Earn Type Override'
WHEN LiabilityType = JCDL_LiabType THEN 'Liability Type Override'
ELSE 'Cost Type' END
UPDATE @JCGLDetail
SET
GLAccountCharged =
CASE WHEN ControllingSetting = 'PhaseOverride-PR Excluded' OR ControllingSetting = 'PhaseOverride-PR Not Excluded'
THEN PhaseGL_Open
WHEN ControllingSetting = 'Earn Type Override' THEN EarnTypeGL_Open
WHEN ControllingSetting = 'Liability Type Override' THEN LiabTypeGL_Open
ELSE CostTypeGL_Open END
RETURN
END
Bob Sutorwell, did you either restart the instance or add another tempdb file (no restart required) to let other transactions continue on the server.
or check if autogrowth was limited, change that to unlimnited , to the transactions conintue..
the function may be dumping the data on to tempdb, how much data are you excepting back...what are indexes on the tables
Hope it Helps!!
Maybe you are looking for
-
Cannot open Logic 9 anymore after recovering to original Lion.
Hi there! I have a Mac mini, osx 10.7.5m 2Ghz Intel Core i7, 8GB 1333 Mhz DDR3. I have the original box of logic 8 & the box to upgrade to Logic 9 as well.(Logic Studio V2.1 Upgrade Pro) I updated my system to Mavericks and all the applications were
-
I'm new to iCal and have inputted all my events, and notice that only the events from one of my colored calendar sections can be highlighted (brighter, bolder colors) at one time (i.e. when I highlight a different colored event in my daily and weekly
-
BEST BUY DELIVERIES ON MONDAY AND WEDNESDAYS ONLY
I again talked to someone at the my local Best Buy store about the status of my Phone 5. I was told again that they have not received any Sprint or Verizon Phones. The next time I should check is this coming up Monday Sept 24 or Wednesday Sept 26th
-
Substitution for Purcahse order and FI document
Dear Friends, I want to update the value from Purchase order (Recipient field) to assignment field while doing goods receipt (MIGO) in FI document. Sort key option doesnt work for it, let me know is there any Exit for this and is it possiable to writ
-
Enlarging a Window To Fill The Entire Screen
This article: http://docs.info.apple.com/article.html?artnum=61474 says that Option + click on zoom button should enlarge a window to fill the screen. It doesn't. It enlarges in a way that is somehow proportional to the content but it won't fill the