I have a simple validation code in Lotusscript to check if an entry is already existing in a view. I use a function with 2 parameters passed ByVal, and is working fine.
But when I added a third parameter, it causes script error when called.
Here's a screenshot of the error I get when using 3 parameters in function call:
Here's function parameter setup:
I can use a workaround for the third parameter, but it makes no sense adding nested if's or select case inside the function, and will not make the function flexible for other modules.
How can I solve this?
I am getting an error
FRM - 40737 - illegal restricted procedure GO_BLOCK in
WHEN-VALIDATE-RECORD trigger.
My Code is
IF event_name = 'WHEN-VALIDATE-RECORD'
THEN
IF (form_name = 'OEXOEORD' AND block_name = 'ORDER')
THEN
-- call procedure to validate and cascade the ship method code.
cascade_ship_method;
execute_query;
END IF;
What am I doing wrong here ?
This is because Oracle Forms has two types of built-in procedures - restricted and unrestricted. Some triggers enable restricted procedures, some not (see Oracle Forms help, every trigger has information which procedures it enables).
Trigger WHEN-VALIDATE-ITEM fires for example when user moves cursor from one record to the other (this is called navigation). In this case it leaves one record and enters other. There is fired following chain of triggers
WHEN-VALIDATE-ITEM
WHEN-VALIDATE-RECORD
POST-ITEM
POST-RECORD
PRE-RECORD
PRE-ITEM
If any of this trigger fails, navigation is canceled and cursor returns to the original item. If you call any procedure, which starts new navigation (like GO_BLOCK), Oracle Forms would not be able to manage first navigation.
This is, why some procedures are restricted.
It might be relevant with content of cascade_ship_method. When I got this error, I had missed an apostrophe in the SET_BLOCK_PROPERTY statement. When I fixed, it worked. This is the correct structure in my code block:
SET_BLOCK_PROPERTY (
'TABLE_A',
default_where,
'column_a= '
|| ''''
|| variable
|| '''');
I am working with existing project, and I am found a sql query with sql-function like
SELECT * FROM money WHERE amount = float_convert(0.1);
This Query is Working Properly, But I want to see and edit the function float_convert();
I am already tried SHOW FUNCTION STATUS,
It's only showing functions status, I need to view the function definition.
SHOW CREATE FUNCTION float_convert
or
SHOW CREATE VIEW float_convert
perhaps ?
I have a Linq to SQL data context class, where I am firing a stored procedure. I can trace through the generated code to where the stored procedure is being fired. I inspect System.Data.Linq.SqlClient.SqlProvider.ExecuteResult and can see that there is a private member called "value" which contains the number of rows updated. There does not appear to be any public accessor for that, and as well the result does not appear to be returned back to the data context anyhow. Is there some other way to access this value or do I have to return ##RowCount from every stored procedure (yuck) ?
Hmm. Admittedly this is a "best guess" as I haven't tried it out with a stored procedure, but is this what you are looking for:
... Do Updates ...
// if sdc is your DataContext
int changedRecords = sdc.GetChangeSet().Updates.Count();
sdc.SubmitChanges();
That's for Updated records and you can replace .Updates with .Inserts and .Deletes as necessary. As long as the stored procedure is part of the data context it should be tracked by the GetChangeSet().
In Reporting Services I would like to add a parameter that contains data from a custom code block. Ideally, I would be able to run the following code (this is a simple testing example):
Function GetPeriods() As String()
Dim values As System.Collections.ArrayList =
New System.Collections.ArrayList()
For i as integer = 1 to 24
values.Add(i)
Next
Return values.ToArray()
End Function
and put the following in the "Text Field" of the parameter:
=Code.GetPeriods()
However, when I run the report, the parameter I apply this to is disabled and empty. Is there a different technique that should be used? Or am I doing something wrong?
If you're using SQL 2008 Reporting Services then you can have a look at this page which introduces the concept of using custom assemblies.
If you're using SQL 2005 Reporting Services then this link is the one you want.
It's a mostly trivial thing, simply compile your code into a class library and follow the instructions provided to allow your report to reference it.
You are returning an array item (an array of strings) into a text field. Instead, try returning a plain string. That should work. If you would still like to return an array list, you must basically bind it to a list control in your RDL. You can definitely do that with dataset extensions. However, I am not sure if there is any other easy way. Check the proprties of the list control and see if it allows you to directly bind to an array list.
You can create the same stored procedure on SQL Server and load parameter values from that procedure.
To access your members/functions implemented in custom code of SSRS report you should set the access modifier to "Public":
Public Function GetPeriods() As String
...
see article Writing Custom Code in SQL Server Reporting Services
I've been trying to do this same thing, set a simple list of parameter values from report code. None of the links in any of these answers shows how to do this and after quite a bit of digging around I don't think it's even possible. Yes it is possible to get the values from a database query, from a web service, or from a custom assembly, but each of these creates a lot of overhead compared to getting the list from a simple function call like =Code.GetValues(), where the function uses a For loop to create the values.
msvcyc is correct in pointing out that the parameter is expecting a string value, but the function is returning an array. I changed the return type to Array as suggested by prashant sable, but the select list is still grayed out, it does not work. And coldice is correct in saying that the access modifier should be Public.
In my digging around I found an article by James Kovac from 2005 that pointed out why this is not possible. The Parameters class has a get method, but no set method. In the VS 2008 object browser for SSRS 2008 the object name has changed, but it still does not contain a set method (see Microsoft.ReportingServices.Interfaces.IParameter.Name or .Value).
My current workaround is to just hard code the list of values, but if your value list needs to be dynamic then your only choices are database queries, web services, or custom assemblies. I think the easiest workaround of these three is to get the values from the database engine, as suggested by oleksiy.t, as long as you can write a query to return the value list you want. Your list of integers, or my list of time intervals, would both be easy queries to write. Otherwise you will need to use one of the other two workarounds.
I checked your code. The only thing that's wrong is your function returns String(). When I changed your method signature to return Array, it worked fine, in my report.
Change the signature to Function GetPeriods() As Array
Everything I've seen requires parameters and their respective settings to be part of the RDL.
That being said, if you're going to "hardcode" the values, you could create a dataset just for the report, perhaps in XML, or if it needs to be programmatically driven, do it in a web service.