Sub String Problem
Hi All,
I have a date field in UTC date formate in the data base table.
For Ex: 20.080.804.121.334,0000000
YY YY MM DD
I want to compare this date with current system date (Ex 20080804)in the report and want to pull the data from table.
Could you please help me out on this??
Thanks in advance.
Sekhar
Instead of converting the stored UTC timestamp to normal date before selecting the data, you can fill the range for the required UTC timestamp and select the data based on that range.
DATA: r_utc type range of timestampl,
l_r_utc like line of r_utc.
DATA: time_stamp TYPE timestampl,
dat TYPE d,
tim TYPE t,
tz TYPE ttzz-tzone,
dst(1) TYPE c.
tz = 'CST'.
dat = sy-datum.
tim = '000000'.
CONVERT DATE dat TIME tim
INTO TIME STAMP l_r_utc-low TIME ZONE tz.
tim = '235959'.
CONVERT DATE dat TIME tim
INTO TIME STAMP l_r_utc-high TIME ZONE tz.
l_r_utc-sign = 'I'.
l_r_utc-option = 'BT'.
append l_r_utc to r_utc.
SELECT * FROM DBTAB
INTO TABLE ITAB
WHERE UTC_TIME IN R_UTC.
Once you get your data into table, you can use the CONVERT TIME STAMP to get the date and time.
CONVERT TIME STAMP time_stamp TIME ZONE tz
INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst.
WRITE: /(10) dat, (8) tim, dst.
Regards,
Naimesh Patel
Similar Messages
-
How to extract sub string value from a string?
Hi,
I need to know how can i extract sub strings from a main
string, something like this:
main variable-------->"2087-5E2SE-19-JG7BC"
i want to split it into like this:
sub_main_1 variable---------> "2087"
sub_main_2 variable---------> "5E2SE"
sub_main_2 variable---------> "19"
sub_main_2 variable---------> "JG7BC"
I did the same in flash by using Split and arrays, like this:
var my_str:String = "2087-5E2SE-19-JG7BC";
var my_array:Array = my_str.split("-");
for (var i = 0; i<my_array.length; i++) {
trace(my_array
this.aaa1 = my_array[1];
this.aaa2 = my_array[2];
this.aaa3 = my_array[3];
this.aaa4 = my_array[4];
My question is that how can i do the same in director ?? i
haven't find any split function in director.
Thanks in advance,
AmirYou do a similar thing in Director using the itemDelimiter,
which is a
_player object property in MX2004. By default, it's a comma:
put _player.itemDelimiter
It will let you get specific items within a string.
p = "2087-5E2SE-19-JG7BC"
_player.itemDelimiter = "-"
put p.item[1]
-- "2087"
You could use it to write yourself a little split function:
on split(theString, theDelimiter)
oldDelim = _player.itemDelimiter
_player.itemDelimiter = theDelimiter
itemList = []
repeat with cnt = 1 to theString.item.count
itemList.add(theString.item[cnt])
end repeat
return itemList
end
p = "2087-5E2SE-19-JG7BC"
a = split(p, "-")
put a
-- ["2087", "5E2SE", "19", "JG7BC"]
Dave -
Adobe Community Expert
www.blurredistinction.com
http://www.adobe.com/communities/experts/ -
Rest query with filter sub-string (contains, not eq)
Hi,
how can I do a REST-query with a filter for a string-column which is only a sub-string? I only found EQ, for example $filter=(name EQ 'tom') which compares the whole string.
But I would like to query records, where a string-column CONTAINS a specific sub-string.
Thx, TomHi Tom,
Do you use it on azure Data Market place? Did you try to add "*" on your query string, like this
post.
Also, you could try this tool from this
thread. Also, for this issue, I suggest you could post it on
SQL forum for better support.
If I misunderstood, please let me know.
Regards,
Will
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi i am geting an out put like this from given text "336 341 sunil" here can i get i prefix and post fix to the this string and highlight it.is this possible.can i use sub strings here
vijayhi
here this code is help full in getting the reslt what i am looking for....
ie to get the searched result as hyper link
selString=document.substring(annot.getBegin(),annot.getEnd());
String preStr= "", postStr="";
if(annot.getBegin()-20<0)
preStr = document.substring(0,annot.getBegin());
else
preStr = document.substring(annot.getBegin()-20,annot.getBegin());
if(annot.getEnd()+20>document.length())
postStr = document.substring(annot.getEnd(),document.length());
else
postStr = document.substring(annot.getEnd(),annot.getEnd()+20);
String outputStr =preStr+"<label style='background-color:yellow;'>"+selString+"</label>"+postStr;
if(i==0){
StrTemp=document.substring(0, annot.getBegin())+selString;
}else{
StrTemp=StrTemp+document.substring(intTemp, annot.getBegin())+selString;
intTemp=annot.getEnd();
out.println(outputStr+"<br><a href='OutputServlet?file="+aFile.getAbsolutePath()+"&begin="+annot.getBegin()+"&end="+annot.getEnd()+"'>"+aFile.getName()+"</a><br><br>");
/* TestType annot = (TestType)itr.next();
out.println("Test UIMA Servlet Begin::"+annot.getBegin()+"<br>");
out.println("Test UIMA Servlet End::"+annot.getEnd()+"<br>");
out.println("Test UIMA Servlet Content::"+annot.getCoveredText()+"<br>");
out.println("Test UIMA Servlet End::"+annot.getType()+"<br>"); */
i++;
StrTemp=StrTemp+document.substring(intTemp,document.length());
thnak u for ur replies -
Any idea how can I search a sub string from a String ignoring white spaces.
Ok, I need to Search a sub string ("for update") from a given String (henceforth Source String) but the condition is it might contain any number of white spaces between these two words (in source string).
So how can I search for "for update" in Source String ignoring any number of (but at least one) white spaces it might have in the source string.
(One way can be searching index of "for" than checking value at index+2 for "update"...and keep trying until i search through entire length of String...but I need some optimized way to do it as I need to check this virtually infinite times in my application)you should "normalize" the string you are searching - that is - first scan it for white space and replace them with single spaces. Then convert it to lower case and search it for what you wish. You could use StringTokenizer -
StringTokenizer st = new StringTokenizer( toBeSearched, " \r\n\t" );
StringBuffer sb = new StringBuffer();
while( st.hasMoreTokens() ) sb.append( st.nextToken() + " " );
String toBeSearchedN = sb.toString().toUpperCase().toLowerCase();
String toSearchForN = toSearchFor.toUpperCase().toLowerCase();
boolean result = ( toBeSearchedN.indexOf( toSearchForN ) != -1 ); -
Hi,
I need help with the sub string.
<fs> means field separator. (char)28.
I have a string like(This is a very big string): "0117<fs> A<fs> 0100 <fs> <fs> <fs>admin <fs>"
I need to get string like: "0117A0100 <fs>admin".
Fields in the string are fixed length but some fields may change like"admin" it can be "register".
Thanks in advance.
Bachi.
Edited by: bachi. on Jul 15, 2009 4:21 PMSorry about that, its not home work I am working on message formatting now. Using regular expressions.
We get the message from the socket like
0117A0100 .admin.01010000FRAZEE.CA810FA1.admin.2 004030508342717836.1..0.0M1000030001000096..1000.
I need to spit that message in to fields and then process the message. We need to send the response back in the same format.
I want to split the string like this. there are some fields which are fixed length and other may change.
0117,A,0100, ,.,admin.,0101,0000,FRAZEE,.,CA810F,A,1,.,admin,.,2, 0040,30508342717836.1..0.0M1000030001000096..1000.
Thanks in advance. -
Sub components problem in custom tag
Hi!
Im writing custom tag that do nothing but can contains other components.
So first I create custom tag with hendler that extends UIComponentTag and component class that extends UIComponentBase
now tag work but i dont see sub components on the page
Second i override encodeChildren and getFamily methods with:
public String getFamily() {
return "MyCaller";
public void encodeChildren(FacesContext context) throws IOException {
Iterator ch=this.getChildren().iterator();
while(ch.hasNext()){
UIComponent oKid = (UIComponent)ch.next();
if(oKid.isRendered()){
oKid.encodeBegin(context);
oKid.encodeChildren(context);
oKid.encodeEnd(context);
super.encodeChildren(context);
}But subcomponents not rendered on page.
So are you know whats wrongthe problem was in wrong getComponentType() that return wrong value
-
Null String and Empty String problem
Hello everyone,
since i am totally new in JSP, i am getting problem in handling strings.
Suppose i have a variable users = ""; then
I want to ask when to use:
if (users.equals(""))
and
if(users == "")
in my code, variable users has value "regional" for regional users.
and i am checking this code as:
if (users.equals{"regional")) {
out.print ("I am inside code");
at that time, the code is throwing error (run time error)
and when i changed the code as:
if (users == "regional") {
out.print ("I am inside code");
this time, the code is not generating error but the part message "I am inside code " is not displaying. The code do not inserts inside the if condition
I hope u understand my problem. Can anybody help me out with this.This has basically nothing to do with JSP, but with basic Java knowledge.
When using the '==' operator to compare Objects (yes, String is actually a subclass of Object), then it will look if they are of the same reference. Using the '==' operator to compare primitive datatypes (int, boolean, char, etc) will look if they have the same value.
That is why the Object class has the equals() method to give the ability compare with another objects. And you can only invoke it when the Object is actually instantiated. So if it is not null.
if (string != null && string.equals("somevalue")) {
// or
if ("somevalue".equals(string)) {
}should work.
Edit rym82: this will not throw a NPE, but an ordinary compilation error ;)
Message was edited by:
BalusC -
POI getCellStyle and empty string problem
I'm having a problem getting the style of a cell from and excel input file and setting to an output file.
I also have a problem recognizing blank cells that are not null in the input file here is my code any help would be great.
package Trace;
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import java.util.StringTokenizer;
import org.apache.poi.poifs.filesystem.*;
import java.lang.Runtime;
public class Converter1 {
private static short bhyvb= 0;
private static short foreground, background;
private static String[][] cellGridOut;
private static int numRows, numColumns, clock;
private static POIFSFileSystem fs;
private static HSSFWorkbook wbin, wbout;
private static HSSFSheet sheetIn, sheetOut;
private static HSSFRow rowIn, rowOut;
private static HSSFCell cellIn, cellIn1, cellOut;
private static FileOutputStream fileOut = null;
private static String rowIterator, rowIterator1;
private static HSSFCellStyle style, style1;
public static void main(String[] args) {
//Take in 2 inputs mandatory, Input Event Trace excel file and Time Interval respectively
if (args.length != 1)System.err.println("Input Excel File");
//Create a new POI file system and HSSF workbook with your excel input file
InputStream input = Converter.class.getResourceAsStream(args[0]);
try{
fs = new POIFSFileSystem(input);
wbin = new HSSFWorkbook(fs);
}catch (Exception e){System.err.println("File input error");}
wbout = new HSSFWorkbook();
sheetIn = wbin.getSheetAt(0);
numRows = sheetIn.getLastRowNum();//numRows=723
style = wbout.createCellStyle();
//style.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
//style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//get number of columns
rowIn = sheetIn.getRow(0);
boolean done = false;
int testNullPointer;
numColumns=0;
while(!done){
//System.out.println(ColumnInc);
cellIn = rowIn.getCell((short)numColumns);
numColumns+=1;
try{
testNullPointer = cellIn.getCellType();
}catch(NullPointerException npe){
done = true;
numColumns-=1; //number of columns = 25
converterIt();
//Create new output file, if it exists delete it
File myFile = new File("converted.xls");
if(myFile.exists()){
myFile.delete();
//Create new file output stream
try {
fileOut = new FileOutputStream(myFile);
} catch (IOException ioe) {}
//write all conversion data to output file
try{
wbout.write(fileOut);
fileOut.close();
}catch (IOException ioe) {}
public static void converterIt(){
boolean nextDone = false;
boolean nextDone1 = false;
for(int i=0; i<numColumns; i++){
clock =1;
rowIn = sheetIn.getRow(0);
cellIn = rowIn.getCell((short)i);
String getTopRow = cellIn.getStringCellValue();
sheetOut = wbout.createSheet(getTopRow+"_s"+i);
sheetOut.setColumnWidth((short)0, (short)(13 * 256));
sheetOut.setDefaultColumnWidth((short)25);
for(int j=0; j<=numRows; j++){
if(j==0){
rowIn = sheetIn.getRow(j);
cellIn = rowIn.getCell((short)i);
String temp2 = cellIn.getStringCellValue();
rowOut = sheetOut.createRow((short)j);
cellOut = rowOut.createCell((short)j);
cellOut.setCellValue(temp2);
cellOut = rowOut.createCell((short)(j+1));
cellOut.setCellValue("CLOCK");
if(j==1){
rowIn = sheetIn.getRow(j);
cellIn = rowIn.getCell((short)i);
double temp3 = cellIn.getNumericCellValue();
rowOut = sheetOut.createRow((short)j);
cellOut = rowOut.createCell((short)0);
cellOut.setCellValue(temp3);
cellOut = rowOut.createCell((short)1);
cellOut.setCellValue("");
nextDone=false;
nextDone1=false;
if(j>1){
rowIn = sheetIn.getRow(j);
try{
cellIn = rowIn.getCell((short)i);
}catch(NullPointerException npe){
rowIterator = "";
nextDone=true;
if(!nextDone){
try{
rowIterator = cellIn.getStringCellValue();
style = cellIn.getCellStyle();
}catch(NullPointerException npe){}
if(j==2){
rowOut = sheetOut.createRow((short)(clock+1));
cellOut = rowOut.createCell((short)0);
cellOut.setCellValue(rowIterator);
cellOut = rowOut.createCell((short)1);
cellOut.setCellValue(j-1);
clock+=1;
}else{
rowIn = sheetIn.getRow(j-1);
try{
cellIn = rowIn.getCell((short)i);
}catch(NullPointerException npe){
rowIterator1 = "";
nextDone1=true;
if(!nextDone){
try{
rowIterator1 = cellIn.getStringCellValue();
}catch(NullPointerException npe){}
if(rowIterator1!=rowIterator && j>2){
rowOut = sheetOut.createRow((short)clock+1);
cellOut = rowOut.createCell((short)0);
cellOut.setCellValue(rowIterator);
//System.out.println(style);
cellOut.setCellStyle(style);
cellOut = rowOut.createCell((short)1);
cellOut.setCellValue(j-1);
clock+=1;
}//if
}//for
}//for
}//converterIt
}//Converter1 CLASSENDI am not sure about the cell style as it looks like you are doing it right. For the null or blank cells it looks like you are only checking for null not "".
-
Crystal Report Sub Report Problems
Hello,
I am unable to use subreports within Crystal.
I call my data from a MySQL connection string, read it into a data set and then display the fields from the datasets within a report. I can do this fine for 1 report, but when I try to include a subreport it does not work.
I have tried lots of diffeent methods but have been unabled to get it working. I have tried the merge tool btw.
Help would be amazing please....
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Web
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As MySqlConnection
Dim myData, myLookUpData As New DataSet
Dim cmd, cmdLookUpData As New MySqlCommand
Dim myAdapter, myAdapterLookUpData As New MySqlDataAdapter
Dim myReport As New ReportDocument
Dim selectProperty As String
con = New MySqlConnection()
selectProperty = "pra50191"
' selectProperty = InputBox("Enter a Property Reference")
'Connection String
con.ConnectionString = ("Server=*****.ukservers.net;Database==****.;UID==****.;Password==*****.")
Try
con.Open()
cmd.CommandText = "SELECT a.no_name, a.address_line1, a.address_line2, a.address_line3,a.address_line4, a.town, a.county, a.postcode, a.display_price, a.general_desc, a.ref, a.viewing_text, a.directions, a.services, b.dimensions_ft, b.dimensions_m, b.description, b.fk_property_ref, b.fk_lookup_rootyp_id FROM tblproperty a, tblproperty_room_details b WHERE a.ref = b.fk_property_ref AND a.ref= '" & selectProperty & "'"
cmdLookUpData.CommandText = "SELECT id, description FROM tbllookup_user"
cmd.Connection = con 'Sets the SQLCommand to the connection string
cmdLookUpData.Connection = con
myAdapter.SelectCommand = cmd 'Sets the MySQL dataadapter to the command (connection string)
myAdapterLookUpData.SelectCommand = cmdLookUpData
myAdapter.Fill(myData) 'Fills the data table
myAdapterLookUpData.Fill(myLookUpData)
myReport.Load("C:\Users\zac\Documents\PJC Report\pjcBrochure2\brochure2\brochure2\testV2.rpt") 'Loads the report (report file location)
myReport.SetDataSource(myData)
myReport.SetDataSource(myLookUpData)
myReport.Database.Tables(0).SetDataSource(myData.Tables(0)) 'Add the tables to the report
myReport.Database.Tables(1).SetDataSource(myLookUpData.Tables(0))
CrystalReportViewer1.ReportSource = myReport 'Loads report into the viewer '
Catch myerror As MySqlException
MsgBox(myerror.Message) 'Error msg if the connection is unable
End Try
End Sub
End ClassI moved your post to the .NET - SAP Crystal Reports forum.
You are not passing anything to the subreport. I htink as it is, you're kinda hoping that somehow the subreport will know what dataset it is supposed to use. There is a couple of ways you can call the subreport and than pass the dataset to it. If you know the name of the subreport:
Dim crSubreportObject As SubreportObject
Dim crSubreportDocument As ReportDocument
crSubreportDocument = crSubreportObject.OpenSubreport("XXX")
crSubreportDocument.SetDataSource(myLookUpData)
or if you do not know the name of the subreport (a more extensible way I suppose you can loop through all the sections of the report looking for the subreport;
Dim crSections As Sections
Dim crSection As Section
Dim crSubreportObject As SubreportObject
'set the crSections object to the current report's sections
crSections = crReportDocument.ReportDefinition.Sections
'loop through all the sections to find all the report objects
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
'loop through all the report objects to find all the subreports
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then
'you will need to typecast the reportobject to a subreport
'object once you find it
crSubreportObject = CType(crReportObject, SubreportObject)
'open the subreport object
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
'set the database and tables objects to work with the subreport
<your .SetDataSource code here>
Next
End If
Next
In all of this, don't forget to consult your developer help file. Looking at the samples [here|https://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples] will also be a good idea.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
Search and replace string problems
Hi to all,
I have problem with Search and replace string function. It shows me a wrong Value (Number) from 15 to 100 is everything OK (15=0, 30=1, 45=2, 100=3), but after 100 ........
Take look in VI and if you have any ideas post them please
THX
Igor
Attachments:
indexing.vi 10 KBthere will be no 15115 string, but 15 or 115 and 15 is 0, 115 is 4. Anyway, i have changed string input format and now its working THX for your help
Attachments:
indexing.vi 10 KB -
Hi everyone, i searched the forum and found same problem with me but i did not work for me. The problem is i cannot connect my sql plus. i enter my username and password then it asks me gor host string but when i type it and enter "ok" it says "TNS Listener does not currentl know of service requested in connect descriptor. i looked at my tnsnames.ora file and is exactly like this.
# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
CSE348 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Canavar)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = cse348)
So what shoul i type to connect sql plus?Given the tnsnames.ora content, the following needs to be entered for sqlplus in order to have it use that connection string in the file:
sqlplus scott/tiger@CSE348As you have not qualified the alias with a domain, it will default to "+.world+" as far as I recall. If the default domain in your local sqlnet.ora differs, than that default will be used to find alias CSE348 in the local tnanmes.ora file. So make sure that you do not mix default and explicit domain names. Rather specify a default domain in sqlnet.ora and use the same domain for defining full qualified domain name TNS aliases in tnsnames.ora.
As for the error - the Listener receives a connection request for a service called cse348 - and no such service has registered with it. You can check the known services of the listener using the "+lsnrctl services+" command on the server.
Often in this case, it is easier to request a specific database instance using its system identifier, or SID. In which case you can change your connection string for the alias to use a SID as follows:
CSE348 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Canavar)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = cse348)
)This assumes that the SID is cse348. The default SID is for example orcl. SIDs like dev and prod are also often used. -
#Name in Access table - Connection string problem
Dear All,
Hope you can help with this one. I am using the 9.0.1.8 ODBC driver set to connect to our Oracle817 database. Usually when connecting tables everything is fine, and no problems appear. There are, however, a small handful of tables that cause ODBC Call Failed errors when I attempt to connect and open them, they display an incorrect record count, and fill all columns with #Name.
After checking someone else's PC, I have found that the problem is caused by the connection string. Obviously the connection string is genereated from the setting used in the ODBC Admin panel, but how do I get it to include or exclude the settings that are causing the problems?
With thanks in advance,
Paul.The Application Name is used for the database administrator to see the name of the application that is connecting to SQL Server. If it is not provided, the default value is '.NET SQLClient Data Provider'.
-
Webutil invoke.string problem with c++
hi ,
am using forms 10g and trying to call a dll in c++
it works when i call the dll using webutil to return an integer from the dll by sending 2 parameters of type varchar2
to invoke the function returning integer
rc1 := WEBUTIL_C_API.Invoke_int('cards_dll.dll','Retrieving',args);
but when i try to return string an error occurs from the exception because oracle cant understand the type returned from c++ dll
this is my code in c++ wish is correct
am sending one parameter in my parameter list of type varcahar2 and i want to return a string from c
f_handle := WEBUTIL_C_API.register_function('cards_dll.dll','Retrieving');
args := WEBUTIL_C_API.create_parameter_list;
param1 := WEBUTIL_C_API.add_parameter(args,WEBUTIL_C_API.C_CHAR_PTR,WEBUTIL_C_API.PARAM_IN ,x,6);
rc1 := WEBUTIL_C_API.Invoke_string('cards_dll.dll','Retrieving',args); -----here is the problem
WEBUTIL_C_API.Destroy_Parameter_List(args);
WEBUTIL_C_API.Deregister_Function(f_handle);
return rc1;
EXCEPTION
WHEN OTHERS THEN
MESSAGE('ERROR:' || ERROR_TEXT);
FOR I IN 1..Tool_Err.Nerrors
LOOP
message (Tool_Err.Message);PAUSE;
Tool_Err.Pop;
END LOOP;
END ;
in c++dll
am using
extern "C" __declspec(dllexport) LPCSTR __cdecl Retrieving(LPCSTR com_reader);
//it means return longpointer and receive long pointer in com_reader
LPCSTR result ;
RESULT = "JIHAD abou ghannam 10081977 august10" as example
return RESULT;
what should i do to receive jihad in forms 10g.
note i can get back an integer using extern "C" __declspec(dllexport) int __cdecl Retrieving(LPCSTR com_reader);
but not a string so its not a hardware or web problem its a type problem i think, no?
there is another way to use other than invoke.string in oracle or i have to change the type LPCSTR IN C++?hi ,
am using forms 10g and trying to call a dll in c++
it works when i call the dll using webutil to return an integer from the dll by sending 2 parameters of type varchar2
to invoke the function returning integer
rc1 := WEBUTIL_C_API.Invoke_int('cards_dll.dll','Retrieving',args);
but when i try to return string an error occurs from the exception because oracle cant understand the type returned from c++ dll
this is my code in c++ wish is correct
am sending one parameter in my parameter list of type varcahar2 and i want to return a string from c
f_handle := WEBUTIL_C_API.register_function('cards_dll.dll','Retrieving');
args := WEBUTIL_C_API.create_parameter_list;
param1 := WEBUTIL_C_API.add_parameter(args,WEBUTIL_C_API.C_CHAR_PTR,WEBUTIL_C_API.PARAM_IN ,x,6);
rc1 := WEBUTIL_C_API.Invoke_string('cards_dll.dll','Retrieving',args); -----here is the problem
WEBUTIL_C_API.Destroy_Parameter_List(args);
WEBUTIL_C_API.Deregister_Function(f_handle);
return rc1;
EXCEPTION
WHEN OTHERS THEN
MESSAGE('ERROR:' || ERROR_TEXT);
FOR I IN 1..Tool_Err.Nerrors
LOOP
message (Tool_Err.Message);PAUSE;
Tool_Err.Pop;
END LOOP;
END ;
in c++dll
am using
extern "C" __declspec(dllexport) LPCSTR __cdecl Retrieving(LPCSTR com_reader);
//it means return longpointer and receive long pointer in com_reader
LPCSTR result ;
RESULT = "JIHAD abou ghannam 10081977 august10" as example
return RESULT;
what should i do to receive jihad in forms 10g.
note i can get back an integer using extern "C" __declspec(dllexport) int __cdecl Retrieving(LPCSTR com_reader);
but not a string so its not a hardware or web problem its a type problem i think, no?
there is another way to use other than invoke.string in oracle or i have to change the type LPCSTR IN C++? -
BufferedReader reader = new BufferedReader(new FileReader(new File(filie)));
String line;
while ((line = reader.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line, "/");
// System.out.println("st"+st);
String path = st.nextToken();
String url = st.nextToken();
String perm = st.nextToken();
String label = path.substring(path.lastIndexOf("/"+1));
// I cannot compile after this line. Can anyone explain me why .I am getting following exception.
String pathToNode = path.substring(0, path.indexOf("/"));
System.out.println("this iis test");
//String pathToNode = path.substring(0, path.l);
//check for the root node
if ("top".equalsIgnoreCase(label) && pathToNode.length() == 0) {
root = new Node(root.getLabel());
// root.setPerm(perm);
// root.setUrl(url);
nodes.put(path, root);
} else {//other node
Node parent = nodes.get(pathToNode);
if (parent == null) {
System.out.println("Parent node not found");
System.exit(-1);
Node child = new Node(label);
//child.setPerm(perm);
// child.setUrl(url);
parent.getChildren().add(child);
nodes.put(path, child);
reader.close();
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
I am getting an error when I am debugging pathtoNode line. I cannot debug it and I am getting above error. please help me on this problem
thanks .
m
My file formate was like that
file.txt
/top/science/earth_scienceStringTokenizer st = new StringTokenizer(line, "/");
String path = st.nextToken();
// I cannot compile after this line. Can anyone explain me why .I am getting following exception.
String pathToNode = path.substring(0, path.indexOf("/"));When you take path out of a StringTokenizer that delimits at slashes, how do you expect path to contain a slash?
Maybe you are looking for
-
Screen goes black for 3 seconds in premiere CS5 every time I click
This is the first time I run Premiere CS5... On a fresh system install. I suspect it's not playing well with my video card, a Radeon HD 4870 with 1GB Ram... Very standard stuff. I am running window 7 64 bit with 12 gb RAM, a week old build. I have a
-
I have an older iMac and I am trying to get an update of iPhoto. Currently I have iPhoto 6.0.6. I thought it would automatically update to the newer versions of iPhoto when I upgraded to OS X? Do I have to purchase this as an extra? iPhoto '11 was
-
Connection Timed Out (Browsing only)
Hello First of all I want to say Thanks BT for providing such amazing service since I switch from 02 2 years ago. I currently got BT Infinity 2 unlimited download 76mb and it has been flawless! No problems whatsoever. I even had a mini LAN even duri
-
DPM 2012 R2 Online Protection - Online Recovery Point Creation Failed
Hi We are moving from protecting our DPM server with another server to use an Azure Data Vault. 2 of the Protection Groups work fine, but the third - protecting a pair of Folders - fails. On the DPM MMC it shows Online recovery point creation faile
-
Anybody's font manager working with InD CS5? PITA to open a doc in CS4 just to activate the fonts, then open in 5 to work on.