Distinguishing Capitalised alphabats in a string
Hi I'm an amatuer at Labview and am encountering a problem. I'm hoping if someone can tell me if it possible in labview to distinguish the words in a string of the form, "RajatKumarWasAtTheZooYesterday".
So, here I'm looking to write a program that can identify and distinguish the strings: Rajat Kumar Was At The Zoo Yesterday
I hope to represent each word in a different way and so would require a program that can identify special characters, such as capitalized alphabats.
Second query: Is it possible to distinguish certain special characters in a string. For example, if the string is "RajatKumar,WasAtTheZooYesterday123", I would want to identify the comma after RajatKumar and/or the numbers123 at the end.
Thanks for helping out!!
Rajat
to know whether it is a capital letter, convert to byte if> 65 and <91 it is a capital letter. Converting the string to a byte array will give you the decimal value of the ascii representation.
Have attaced an Ascii table
"Everything should be made as simple as possible but no simpler"
Attachments:
ascii_table.pdf 43 KB
Similar Messages
-
To fix the length of a textfield for user to enter date
hi,
i need to display a textfield for user to enter the date in the format MM/DD/YY.With the slash in between present and fixed and the possibility of entering only 2 digit figures for the month,day n' year.I am using JTextField .how can i acheive that pls help.You must design you own document where you will manage the text that will be entered/displayed in your textfield
here's a sample of the code I use to do this:
import javax.swing.JTextField;
import java.io.*;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
public class MaskedTextField extends JTextField
private String initStr;
public MaskedTextField (String mask, String initStr)
super();
setDocument(new MaskedDocument(initStr, mask, this));
setText(initStr);
this.initStr = initStr;
this.addMouseListener(new java.awt.event.MouseAdapter()
public void mouseClicked(MouseEvent m)
this_mouseClicked(m);
private void this_mouseClicked(MouseEvent m)
if (getText().equals(initStr)) setCaretPosition(0);
class MaskedDocument extends PlainDocument
String mask;
String initStr;
JTextField tf;
public MaskedDocument(String initStr, String mask,
MaskedTextField container)
this.mask = mask;
this.initStr = initStr;
tf = container;
void replace(int offset, char ch, AttributeSet a)
throws BadLocationException
super.remove(offset,1);
if (capitalised) super.insertString(offset,
String.valueOf(ch).toUpperCase(),a);
else super.insertString(offset, "" + ch, a);
public void remove(int offs, int len) throws BadLocationException
if (len==0)
return;
// Remove current contents
super.remove(offs, len);
// Replace the removed part by init string
super.insertString(offs,initStr.substring(offs,offs+len),
getAttributeContext().getEmptySet());
tf.setCaretPosition(offs);
public void insertString(int offset, String str, AttributeSet a)
throws BadLocationException
if ((offset==0) && str.equals(initStr))
// Initialisation of text field
super.insertString(offset,str,a);
return;
if (str.length()==0)
super.insertString(offset,str,a);
return;
for (int i=0;i<str.length();i++)
while ((offset+i) < mask.length())
if (mask.charAt(offset+i)=='-')
// Skip fixed parts
offset++;
else
// Check if character is allowed according to mask
if (str.charAt(i) != this.initStr.charAt(i))
switch (mask.charAt(offset+i))
case 'D': // Only digitis allowed
if (!Character.isDigit(str.charAt(i)))
return;
break;
case 'C': // Only alphabetic characters allowed
if (!Character.isLetter(str.charAt(i)))
return;
break;
case 'A': // Only letters or digits characters allowed
if (!Character.isLetterOrDigit(str.charAt(i)))
return;
break;
replace(offset+i, str.charAt(i),a);
break;
else
i++;
offset--;
// Skip over "fixed" characters
offset += str.length();
while ((offset<mask.length()) && (mask.charAt(offset)=='-'))
offset++;
if (offset<mask.length())
tf.setCaretPosition(offset);
if (offset == mask.length()) tf.setCaretPosition(offset);
Enjoy
Bernie -
How to distinguish NULL and Empty Strings
Hi,
Just to set the context right; I'm an experienced C programmer trying labview for the first time. As such I ran in to a problem being that Labview has no concept of NULL-pointers and more specifically appears to have no concept of the difference between a NULL-string and an empty-string
I'm trying to make a structure (bundle) of strings (in it's most basic form key-value pairs) which i'd like to (for instance) URI encode in order to send it to a web server. For those who are not familiar with URI encoding; there is a distinguished difference between setting a key to an empty string and setting a key with no value. In C I would use a pointer to an empty string vs a NULL string pointer to symbolize this.
In essence I need an elegant way to distinguish between a defined but empty string and an undefined string (hmmm this is actually describing the same problem but now in terms of perl).
Anybody have any pointers (pun not intended) for me ?This is a bit depending on the interface you have with your encoder. The whole issue is that LV has no pointers at all (and you will like it, as you will never have any Null-Pointer exeptions and the like).
Assuming that you use a dll (so the Call Library node).
Use CString as input -> NULL-Terminated String.
Use I32 as input and pass 0 -> NULL string.
Felix
www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml -
Distinguishing between empty string and null values
hi all,
I am using an ODBC connection to connect my java app to database using JDBCODBC driver. I have 2 columns 'aColumn' and 'bColumn' in my table, both allow null values. I have one row in it, which has null value in aColumn and empty string in bColumn. I retrieve this row's data and assign it to 2 columns : 'aColumnVar' and 'bColumnVar' respectively. I find out that both 'aColumnVar' and 'bColumnVar' variables has null values (although bColumnVar should has an empty string as its value). Now my ODBC connection Data Source has the option "Use ANSI nulls, paddings, and warnings" ON. I turn it off and try again. This time both 'aColumnVar' and 'bColumnVar' variables has empty string as values (although aColumnVar should has null as its value).
How can I make sure that i can get the data exactly as it is in the database in my variables?
Thanksthere is a wasNull() method on ResultSet. After you
have obtained the value of a column e.g. by calling a
method like getString you can call wasNull and if it
returns true then the value on the database is null.
Check the java docs, it might explain it better
http://java.sun.com/j2se/1.4.1/docs/api/java/sql/Result
et.html#wasNull()I am using MS SQL Server 7.0 under Windows NT 4.0 with JDK 1.2. My ODBC connection Data Source has to have the option "Use ANSI nulls, paddings, and warnings" ON.
I try the wasNull() method but it is doing the same thing i.e. telling me that a column is null when in database it is null (right); and a column is null when in database it is an empty string (wrong). I suspect it is something to do with the JDBC-ODBC driver I am using. -
How to distinguish textmodel string in two different fonts.
Hello All,
I have indesign cs3 textmodel with more than one font used in it, with diffrent font attributes.
How I will come to know that form where different font use is started , and how should I retrive the attribute.
I am able to get the fonts used in the textmodel.But how should I retrive the position in the textmodel.
Like :-
some text with :- Microsoft Sans Serif Bold, font size 48
some text with :-Times new Roman Regular, font size 28
Please reply.Hi ,
Thanks for reply.
Using IAttributestrand::GetLocalOverrides I am able to get the range of characters with same font attribute, But I am retriving font name and font style as null.
Please reply. -
Null and empty string not being the same in object?
Hello,
I know that null and empty string are interpreted the same in oracle.
However I discovered the strange behaviour concerning user defined objects:
create or replace
TYPE object AS OBJECT (
value VARCHAR2(2000)
declare
xml xmltype;
obj object;
begin
obj := object('abcd');
xml := xmltype(obj);
dbms_output.put_line(xml.getStringVal());
obj.value := '';
xml := xmltype(obj);
dbms_output.put_line(xml.getStringVal());
obj.value := null;
xml := xmltype(obj);
dbms_output.put_line(xml.getStringVal());
end;
When creating xml from object, all not-null fields are transformed into xml tag.
I supposed that obj.value being either '' or null will lead to the same result.
However this is output from Oracle 9i:
<OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
<OBJECT_ID><VALUE></VALUE></OBJECT_ID>
<OBJECT_ID/>
Oracle 10g behaves as expected:
<OBJECT><VALUE>abcd</VALUE></OBJECT>
<OBJECT/>
<OBJECT/>
However Oracle 9i behaviour leads me to the conclusion that oracle
must somehow distinguish between empty string and null in user defined objects...
Can someone clarify this behaviour?
Thus is it possible to test if object's field is empty or null?However Oracle 9i behaviour leads me to the conclusion that oracle
must somehow distinguish between empty string and null in user defined objects...
Can someone clarify this behaviour?
Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs. -
How can I distinguish different action mapping in one ActionClass file?
I would like to create a ActionClass which will handle 3 mapping which comes from /add, /show or /del.
My question is how can I change the code so that the ActionClass servlet can distinguish the request from different url mapping ? Can anyone give me some short hints? Thx.
struts-config.xml
<action-mappings>
<action name="MemberInfoForm" path="/add" scope="request" type="com.myapp.real.MemberAction">
<action name="MemberInfoForm" path="/show" scope="request" type="com.myapp.real.MemberAction">
<action name="MemberInfoForm" path="/del" scope="request" type="com.myapp.real.MemberAction">
</action-mappings>MemberAction.class
public class MemberAction extends org.apache.struts.action.Action {
private final static String SUCCESS = "success";
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward(SUCCESS);
...http://struts.apache.org/1.2.x/api/org/apache/struts/actions/MappingDispatchAction.html
http://struts.apache.org/1.2.x/api/org/apache/struts/actions/DispatchAction.html
Thank you so much for all of your suggestion.
I read the document of MappingDispatchAction and its note say:
NOTE - Unlike DispatchAction, mapping characteristics may differ between the various handlers, so you can combine actions in the same class that, for example, differ in their use of forms or validation.........
I wonder in DispatchAction, we can also have various forms or validation as MappingDispatchAction does, just by using different name in the action tag, for example:
<action input="/p1.jsp" name="MForm1" path="/member" scope="session" parameter="action" type="com.myapp.real.MemberAction">
<action input="/p2.jsp" name="MForm2" path="/member" scope="session" parameter="action" type="com.myapp.real.MemberAction">
<action input="/p3.jsp" name="MForm3" path="/member" scope="session" parameter="action" type="com.myapp.real.MemberAction">Hence, it is not the difference as stated from the NOTE, right?
Edited by: roamer on Jan 22, 2008 10:32 AM -
Seperation of contents in the string
Hi Guru's,
I was assigned a little bit query related to updation of text for LFA1 object. I would like to expalin my requirement in details. I have 2 texts like Z001 & Z002. Z001 stores range of PRO numbers. Z002 is for display the current PRO number related to perticular vendor. we need to update that Z002 by code it self. Suppose Z001 contains the range like this (ROADWAY 444 100 , ROADWAY 444 999). I need to update Z002 with the next value starting from lower value like
(ROADWAY 444100,ROADWAY 444 101,ROADWAY 444 102...........). For each vendor length of PRO # may change. Now my problem is how can i seperate alphabates and numerics in this string (ROADWAY 444 100..) for updating Z002 with next PRO#. Kindly help me out in this scenario and your help will be greatly appriciated.
Regards,
Ravi.Hi Ravi,
You can split the string into parts..
DATA : begin of itab OCCURS 0,
line type char100,
end of itab.
SPLIT z001
AT space
INTO TABLE itab.
Now if you are sure that the 3rd record will be which you need to use..
Then, LOOP AT itab INDEX 3.
MOVE itab-line TO w_num.
w_num = w_num + 1.
ENDLOOP.
Thanks and Best Regards,
Vikas Bittera.
**Reward if useful** -
Delphi 3 or Delphi XE gives Invalid class string error
I have Delphi 3 and a runtime error occurs when I RUN this project. No build errors...
The form appears correctly and I put the path to the GroupWise domain directory :
F:\opt\novell\groupwise\mail\dom1
I click on the CONNECT button and the error is :
"Project admin_api.exe raised an exception class EOleSysError with message 'Invalid class string'. Process stopped. Use Step or Run to Continue"
For Delphi XE the error is only "Invalid class string".
What am I doing wrong ?
Thank You
Have downloaded the same GroupWise Administrative Object API code
https://www.novell.com/developer/ndk...bject_api.html
unit App_obj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleAuto, Ole2;
type
TForm1 = class(TForm)
Button1: TButton;
Label6: TLabel;
UserID: TEdit;
Label7: TLabel;
LastName: TEdit;
Label8: TLabel;
FirstName: TEdit;
UserDistinguishedName: TEdit;
Label10: TLabel;
SystemInfo: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
SystemDescription: TEdit;
SystemDistinguishedName: TEdit;
SystemLastModifiedBy: TEdit;
ConnectedDomainName: TEdit;
SystemObjectID: TEdit;
PostOfficeList: TComboBox;
Label11: TLabel;
Label9: TLabel;
UserContext: TEdit;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
DomainPath: TEdit;
Button2: TButton;
procedure Initialize(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
vSystem:variant;
vDomain:variant;
const
ADMIN_NAME = 'Admin';
sDOT = '.';
implementation
{$R *.DFM}
procedure TForm1.Initialize(Sender: TObject);
begin
//Initialize controls
DomainPath.Text:='';
SystemDescription.Text:='';
SystemDistinguishedName.Text:='';
SystemLastModifiedBy.Text:='';
ConnectedDomainName.Text:='';
SystemObjectID.Text:='';
UserID.Text:='';
LastName.Text:='';
FirstName.Text:='';
UserDistinguishedName.Text:='';
UserContext.Text:='';
UserID.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
vUsers:variant;
vUser:variant;
stemp:string;
idotpos:integer;
SelectedPO:string;
sAdmin:string;
begin
//Get Selected PostOffice
SelectedPO:=PostOfficeList.Items[PostOfficeList.ItemIndex];
//Get Users Object
vUsers:=vDomain.Users;
//Find Admin user object
vUser:=vUsers.Item(ADMIN_NAME,SelectedPO,Connected DomainName.Text);
If UserContext.Text = '' then begin
//Get Admin Context and use as Default
sAdmin:=vUser.NetID;
idotpos:=Pos(sDOT,sAdmin);
stemp:=Copy(sAdmin,idotpos,256); //Copy everything after first dot include dot
UserContext.Text:=stemp;
end else begin
//Use context string
stemp:=UserContext.Text;
end;
//Make Distinguished name by adding UserID and admin context
stemp:=UserID.Text+stemp;
//Display User distinguished name
UserDistinguishedName.Text:=stemp;
//Add user
vUser:=vUsers.Add(UserID.Text,LastName.Text,stemp,
'',SelectedPO);
//Set User first name
vUser.GivenName:=FirstName.Text;
//Commit User first name to system
vUser.Commit;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
vPostOffice:variant;
vPostOffices:variant;
vPOIterator:variant;
begin
//Get GroupWise Admin Object and connect to it
if(DomainPath.Text = '') then begin
ShowMessage('You must enter a valid Domain Path. Then press Login');
exit;
end;
vSystem:=CreateOleObject('NovellGroupWareAdmin');
vSystem.Connect(DomainPath.Text);
//Get the connected Domain
vDomain:=vSystem.ConnectedDomain;
//List some Domain properties
SystemDescription.Text:=vDomain.Description;
SystemDistinguishedName.Text:=vDomain.Distinguishe dName;
SystemLastModifiedBy.Text:=vDomain.LastModifiedBy;
ConnectedDomainName.Text:=vDomain.Name;
SystemObjectID.Text:=vDomain.ObjectID;
//Initialize controls
UserID.Text:='';
LastName.Text:='';
FirstName.Text:='';
UserDistinguishedName.Text:='';
UserContext.Text:='';
UserID.SetFocus;
//Get list of PostOffices for connected Domain
vPostOffices:=vDomain.PostOffices;
vPOIterator:=vPostOffices.CreateIterator;
vPostOffice:=vPOIterator.Next;
PostOfficeList.Clear;
While( (NOT VarIsNULL(vPostOffice)) And (NOT varisempty(vPostOffice))) do begin
PostOfficeList.Items.Add(vPostOffice.Name);
vPostOffice:=vPOIterator.Next;
end;
//Set index to first item in list
PostOfficeList.ItemIndex:=0;
end;
end.On 9/24/2013 10:46 PM, bperez wrote:
>
> I have Delphi 3 and a runtime error occurs when I RUN this project. No
> build errors...
>
> The form appears correctly and I put the path to the GroupWise domain
> directory :
>
> F:\opt\novell\groupwise\mail\dom1
>
> I click on the CONNECT button and the error is :
>
> "Project admin_api.exe raised an exception class EOleSysError with
> message 'Invalid class string'. Process stopped. Use Step or Run to
> Continue"
>
> For Delphi XE the error is only "Invalid class string".
>
> What am I doing wrong ?
>
> Thank You
>
> Have downloaded the same GroupWise Administrative Object API code
> https://www.novell.com/developer/ndk...bject_api.html
>
> {/************************************************** *************************
>
> ************************************************** **************************/}
> unit App_obj;
>
> interface
>
> uses
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
> Dialogs,
> StdCtrls, OleAuto, Ole2;
>
> type
> TForm1 = class(TForm)
> Button1: TButton;
> Label6: TLabel;
> UserID: TEdit;
> Label7: TLabel;
> LastName: TEdit;
> Label8: TLabel;
> FirstName: TEdit;
> UserDistinguishedName: TEdit;
> Label10: TLabel;
> SystemInfo: TGroupBox;
> Label1: TLabel;
> Label2: TLabel;
> Label3: TLabel;
> Label4: TLabel;
> Label5: TLabel;
> SystemDescription: TEdit;
> SystemDistinguishedName: TEdit;
> SystemLastModifiedBy: TEdit;
> ConnectedDomainName: TEdit;
> SystemObjectID: TEdit;
> PostOfficeList: TComboBox;
> Label11: TLabel;
> Label9: TLabel;
> UserContext: TEdit;
> Label12: TLabel;
> Label13: TLabel;
> Label14: TLabel;
> Label15: TLabel;
> Label16: TLabel;
> DomainPath: TEdit;
> Button2: TButton;
> procedure Initialize(Sender: TObject);
> procedure Button1Click(Sender: TObject);
> procedure Button2Click(Sender: TObject);
> private
> { Private declarations }
> public
> { Public declarations }
> end;
>
> var
> Form1: TForm1;
> vSystem:variant;
> vDomain:variant;
>
> const
> ADMIN_NAME = 'Admin';
> sDOT = '.';
>
> implementation
>
> {$R *.DFM}
>
> procedure TForm1.Initialize(Sender: TObject);
> begin
> //Initialize controls
> DomainPath.Text:='';
> SystemDescription.Text:='';
> SystemDistinguishedName.Text:='';
> SystemLastModifiedBy.Text:='';
> ConnectedDomainName.Text:='';
> SystemObjectID.Text:='';
>
> UserID.Text:='';
> LastName.Text:='';
> FirstName.Text:='';
> UserDistinguishedName.Text:='';
> UserContext.Text:='';
> UserID.SetFocus;
>
> end;
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
> vUsers:variant;
> vUser:variant;
> stemp:string;
> idotpos:integer;
> SelectedPO:string;
> sAdmin:string;
> begin
> //Get Selected PostOffice
> SelectedPO:=PostOfficeList.Items[PostOfficeList.ItemIndex];
>
> //Get Users Object
> vUsers:=vDomain.Users;
>
> //Find Admin user object
> vUser:=vUsers.Item(ADMIN_NAME,SelectedPO,Connected DomainName.Text);
>
> If UserContext.Text = '' then begin
>
> //Get Admin Context and use as Default
> sAdmin:=vUser.NetID;
> idotpos:=Pos(sDOT,sAdmin);
> stemp:=Copy(sAdmin,idotpos,256); //Copy everything after first dot
> include dot
> UserContext.Text:=stemp;
>
> end else begin
> //Use context string
> stemp:=UserContext.Text;
> end;
>
> //Make Distinguished name by adding UserID and admin context
> stemp:=UserID.Text+stemp;
>
> //Display User distinguished name
> UserDistinguishedName.Text:=stemp;
>
> //Add user
> vUser:=vUsers.Add(UserID.Text,LastName.Text,stemp,
> '',SelectedPO);
>
> //Set User first name
> vUser.GivenName:=FirstName.Text;
>
> //Commit User first name to system
> vUser.Commit;
> end;
>
>
>
> procedure TForm1.Button2Click(Sender: TObject);
> var
> vPostOffice:variant;
> vPostOffices:variant;
> vPOIterator:variant;
>
> begin
> //Get GroupWise Admin Object and connect to it
> if(DomainPath.Text = '') then begin
> ShowMessage('You must enter a valid Domain Path. Then press
> Login');
> exit;
> end;
> vSystem:=CreateOleObject('NovellGroupWareAdmin');
>
>
> vSystem.Connect(DomainPath.Text);
> //Get the connected Domain
> vDomain:=vSystem.ConnectedDomain;
>
> //List some Domain properties
> SystemDescription.Text:=vDomain.Description;
> SystemDistinguishedName.Text:=vDomain.Distinguishe dName;
> SystemLastModifiedBy.Text:=vDomain.LastModifiedBy;
> ConnectedDomainName.Text:=vDomain.Name;
> SystemObjectID.Text:=vDomain.ObjectID;
>
> //Initialize controls
> UserID.Text:='';
> LastName.Text:='';
> FirstName.Text:='';
> UserDistinguishedName.Text:='';
> UserContext.Text:='';
> UserID.SetFocus;
>
> //Get list of PostOffices for connected Domain
> vPostOffices:=vDomain.PostOffices;
> vPOIterator:=vPostOffices.CreateIterator;
> vPostOffice:=vPOIterator.Next;
> PostOfficeList.Clear;
> While( (NOT VarIsNULL(vPostOffice)) And (NOT
> varisempty(vPostOffice))) do begin
> PostOfficeList.Items.Add(vPostOffice.Name);
> vPostOffice:=vPOIterator.Next;
> end;
>
> //Set index to first item in list
> PostOfficeList.ItemIndex:=0;
> end;
>
> end.
>
>
gw client installed? Novell client installed? -
Hi all,
I have a problem with distinguished name dn string. By the way, I am new to dn string.
under active dir win2008 I have 2 organizational units. such as, ou=I.T. and ou=darknight
I.T. - has user1 -- it has dots after I and T
darknight - has user2
Both of OU s are under darknight.com as organizational units. When I type for distinguished name in apex ldap auth., I can write only one of them in order to successfully authenticate for appropriate user names.
cn=%LDAP_USER%,ou=I.T.,dc=darknight,dc=com
or
cn=%LDAP_USER%,ou=darknight,dc=darknight,dc=com
In case of both OU s as below:
cn=%LDAP_USER%,ou=darknight,ou=I.T.,dc=darknight,dc=com
it does not work giving "invalid credentials" error for any user. So, how can I make dual ou in dn string? or what is the solution for dual organizational units?
Thanks in advance.
Edited by: Zair S. on Jun 8, 2012 5:13 AMI've been thinking about this issue since your original post.. I was wondering if it'd be possible to use macro ACIs to implement this...
For example, you could create an objectClass called "publicOU" and assign it to your OUs you want to be public. Then, you could use an ACI like this (heavily borrowed from the DS 6.2 documentation):
aci: (targetattr="*")
(targetfilter=(objectClass=publicOU))(version 3.0;
acl "Allow Public OUs to be visible"; allow (read,search) userdn=
"ldap:///anyone";)
There may be more elegant ways to do this, but I think it would work... -
Adding a JSON string to an outbound RESTful call in OSB 11.1.1.6
Inside my Proxy Service Message Flow (OSB 11.1.1.6) I have generated a JSON string and stored it in a variable named $jsonReq.
In my Routing action, I point to a Business Service whose Service Type is "Messaging Service" with both Request/Response Message Types as "Text".
What is the proper way to assign the $jsonReq variable's contents to the outbound request body (I am doing a POST)?
I have tried a number of configurations, but to no avail (though I see the JSON contents when I dump it out in a Log action), such as:
Insert
Expression: $jsonReq
Location: as first child of
XPath: .
In Variable: outbound
Please advise.
Thank you,
MichaelHello Prabu,
Thank you for the suggestion. Assigning it to the body didn't work. I changed my configuration to this:
Insert
Expression: $jsonReq
Location: as first child of
XPath: .
In Variable: outbound
The net effect that I can see via the Test Console invocation tracing is that the change from:
RouteToMyBusinessService -> Message Context Changes -> changed $body
<soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<!-- our original body from the proxy service inbound SOAP message -->
</soap:Body>
to
RouteToMyBusinessService -> Message Context Changes -> changed $body
<soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope"/>
I know that the $jsonReq has data in it (per a log statement I made: <Jun 6, 2013 7:55:40 AM CDT> <Debug> <ALSB Logging> <BEA-000000> < [RouteToSCCreateBAMLabsProfileBusSvc, null, null, REQUEST] Inserted {"firstName":"string","lastName":"s","email":"stringstring","Login":"string","timeZone":"America/Montevideo","address":{"streetOne":"string","streetTwo":"string","city":"string","state":"st","zipCode":"string","country":"string"},"equipment":{"e":{"type":"Bed","code":"string","serial":"string","sku":"string","version":"string","dateOfPurchase":"2013-11-23T08:44:07"}}} into body> ).
So why would the body be empty when I use the Insert action listed above?
On a side note, is there only one 'body' variable in a proxy message flow? How do I distinguish between the body of the incoming request, the body of the [transformed] outgoing business service request, the body of the business service response and the body of the [transformed] proxy service response?
Thanks again,
Michael -
Insert set of character in a string
hi guys,
I have created a string of length 19, i need to insert set of character and compare them if its right format or not.That is for barcode i need. i WANT MY PROGRAM TO GENERATE THIS FORMAT BARCODE.
eg : INV40602007RE000155Hi
SEARCH
Variants:
1. SEARCH f FOR g.
2. SEARCH itab FOR g.
Note
Like all string processsing statements, you can only use character-type operands here.
If the type of an operand is not STRING, the operand is treated like a type C field, regardless of its actual type, even though no actual conversion takes place.
See Only character fields allowed in string processing.
Variant 1
SEARCH f FOR g.
Additions:
1. ... ABBREVIATED
2. ... STARTING AT n1
3. ... ENDING AT n2
4. ... AND MARK
Effect
Searches the contents of f for the string in the field g. This string can have any of the following formats:
'str'
a character string (trailing spaces are ignored)
'.str.'
any character string between the periods
'*str'
a word ending with "str", including "str"
'str*'
a word beginning with "str", including "str"
You can use any non-alphanumeric character as a separator, that is, spaces, punctuation marks and non-printable characters.
Note
The search patterns 'str' and '.str.' are identical apart from a few exceptions. You must use '.str.' when the pattern str contains spaces (at the end), the '.' character (at the beginning and end), or the '*' character (at the end). You should also use '.str.' when the contents of the search string str is a variable, since you cannot predict when you write the statement what the contents of the string will be.
The system does not distinguish between upper and lower case characters.
The return code is set as follows:
SY-SUBRC = 0:
The search string g was found in the field f. SY-FDPOS contains the offset of the found string or the found word within the field.
SY-SUBRC = 4:
The search string g was not found in the field f.
Addition 1
... ABBREVIATED
Effect
Searches the field f for a word containing the character string specified in the field. Here, the characters specified in g may be separated by other characters in the word. If the string g occurs in a word, the return code in system field SY-SUBRC is set to 0. The first letter of the search string g and of the word must match.
Example
DATA F(50).
MOVE 'Alaska Texas California' TO F.
SEARCH F FOR 'Clfrn' ABBREVIATED.
Here, SY-SUBRC is set to 0, since not only does the string 'Clfrn' occur (separated by other characters) in 'California', but 'Clfrn' and 'California' begin with the same letter.
Addition 2
... STARTING AT n1
Effect
Searches the field f starting from the position n1. Here, n1 can also be a field containing the corresponding value. The first character in the field f is in position 1.
When you use the addition STARTING AT, the position specified for the found pattern in SY-FDPOS does not refer to the start of the field, but to the position n1.
Addition 3
... ENDING AT n2
Effect
Searches the field f up to the position n2.
Addition 4
... AND MARK
Effect
If the search string g is found, all the characters of the search string and all the characters occurring in between (in the case of SEARCH ABBREVIATED) are converted to upper case in the field f.
Example
DATA F(20) VALUE 'Peter Paul Mary'.
SEARCH F FOR '*UL' AND MARK.
SY-SUBRC is now set to 0, since the search string was found in 'Paul'. SY-FDPOS has the value 6, since the character string found starts at the offset 6. Also, the search string is marked, so that the new contents of f are as follows:
'Peter PAUL Mary'
Variant 2
SEARCH itab FOR g.
Additions:
1. ... ABBREVIATED
2. ... STARTING AT line1
3. ... ENDING AT line2
4. ... AND MARK
Effect
Searches the internal table itab for the string in field g. The string can have the same format as in variant 1. The value of SY-SUBRC is set to 0, if the search string is found in the table. The system field SY-TABIX then contains the number of the table line where the string was found. Meanwhile, SY-FDPOS specifies the offset of the found string within the table line.
Note
The statement does not search the header line of an internal table itab.
Addition 1
... ABBREVIATED
Effect
As with SEARCH ABBREVIATED, searches the internal table itab for a word that contains the character string specified in the field g. Here, the characters specified in g can be separated by other characters in the word. The return code value of the system field SY-SUBRC is set to 0, if the string g occurs in a word. The first letter of the search string g and of the word must match.
Addition 2
... STARTING AT line1
Effect
Searches the internal table itab starting from line line1 to the end. line1 can be a field that contains the corresponding values.
Addition 3
... ENDING AT line2
Effect
Searches the internal table itab up to the line line2.
Addition 4
... AND MARK
Effect
If the search string g is found, all the characters of that search string and all the characters occurring in between (in the case of SEARCH ABBREVIATED) are converted to upper case in the internal table itab.
Example
Let T be an internal table which is empty:
TYPES: BEGIN OF T_TYPE,
LINE(80),
END OF T_TYPE.
DATA: T TYPE STANDARD TABLE OF T_TYPE WITH
NON-UNIQUE DEFAULT KEY,
WA_T TYPE T_TYPE.
MOVE 'Alaska Texas ' TO WA_T.
APPEND WA_T TO T.
MOVE 'California Arizona ' TO WA_T.
APPEND WA_T TO T.
SEARCH T FOR '*ONA' AND MARK.
SY-SUBRC is now set to 0 because the search string was found in 'Arizona'. SY-TABIX contains the value 2 because 'Arizona' appears in the second line of the table T. SY-FDPOS is set to 11 because the found character string begins at the offset 11. Also, the search string was marked in the second line in such a way that the contents of that line now look as follows:
'California ARIZONA'
Note
Performance:
Searching generically for a string in an internal table is much more runtime-intensive (approx. 5000 msn (standardized microseconds)) than searching for 'str' (approx. 20 msn). This was measured using a table with 200 entries and 10 fields.
If you perform a search in a field which is 50 bytes long for 'str' or 'str', the runtime consumption is approx. 300 msn, whereas searching for 'str' takes about 15 msn.
Regards,
Raghav -
Read linux lastlog file and convert to a String
Hi
I am trying to read the data from the lastlog file in Linux. I think this is a binary file encoded in ASCII. How would I go about reading this file and converting the binary data into a String and then displaying the data? Each bit of data is separated by a new line to distinguish between the different values.
Many Thanks
Sambo"Binary file encoded in ASCII"? Well, you'd have to find out what encoding was used and then reverse is.
As for reading files in general, check here:
http://java.sun.com/docs/books/tutorial/essential/io/index.html -
Dears
We have a scenario where bank is using NTRF both for check and Bank Transfer. Only way to distinguish that it is check is that immediately after External Transaction the check number is of 6 character otherwise it is Bank Transfer. In the EBS configuration with each External Transaction we can assign only one Posting Rule and algorithm.
We come to know that through search strings we can change the posting rule and algoritham. We went to many answer on net to work on search strings but so far nothing successful. Can someone guide us how to use it.
ThanksHi Expert,
Please refer to the below link which will help in configuring Search Strings for your scenario.
http://help.sap.com/saphelp_46c/helpdata/es/af/0a242bc925d311b60f0060b03c2bff/content.htm
http://help.sap.com/saphelp_46c/helpdata/en/6d/0cdf4b142e11d3963800a0c9426c73/content.htm
Regards,
GK
SAP -
Determine characters and words in a string
Hi
How do you write code to scan one line of string input and determine
the total number of characters and words on one line?
Please reply soon.
Thanks,
Sincerely,
EganHow do I use the stringTokenizer class?http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html
java.util
Class StringTokenizer
java.lang.Object
'- java.util.StringTokenizer
All Implemented Interfaces:
Enumeration
public class StringTokenizer
extends Object
implements Enumeration
The string tokenizer class allows an application to break a string into tokens. The tokenization method is much simpler than the one used by the StreamTokenizer class. The StringTokenizer methods do not distinguish among identifiers, numbers, and quoted strings, nor do they recognize and skip comments.
The set of delimiters (the characters that separate tokens) may be specified either at creation time or on a per-token basis.
An instance of StringTokenizer behaves in one of two ways, depending on whether it was created with the returnDelims flag having the value true or false:
If the flag is false, delimiter characters serve to separate tokens. A token is a maximal sequence of consecutive characters that are not delimiters.
If the flag is true, delimiter characters are themselves considered to be tokens. A token is thus either one delimiter character, or a maximal sequence of consecutive characters that are not delimiters.
A StringTokenizer object internally maintains a current position within the string to be tokenized. Some operations advance this current position past the characters processed.
A token is returned by taking a substring of the string that was used to create the StringTokenizer object.
The following is one example of the use of the tokenizer. The code: StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
} prints the following output: this
is
a
test StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.
The following example illustrates how the String.split method can be used to break up a string into its basic tokens: String[] result = "this is a test".split("\\s");
for (int x=0; x<result.length; x++)
System.out.println(result[x]); prints the following output: this
is
a
testP.S. You are welcome.
Maybe you are looking for
-
My phone wont let me turn my wifi on
My phone wont let me turn my wifi on
-
Send to Back Puts Image Behind MASTER Elements
I have a full screen image on a master slide. When I Send to Back an image on a slide using that master, it sends it behind the full screen image, effectively making it disappear. It doesn't make any sense why master elements are "live" and part of t
-
Nokia E 7 Ovi showing uninstall and reinstall communities.
-
Aperture 3 - a catalogue of disasters.
OK, I have Aperture 3. ITried the Demo - it seemed fine so I plonked down for the upgrade. Here are the problems I have been having so far: • Faces seems to take an age to do anything. There have been times when I've entered a new person's name using
-
Cannot get to print from Quicken program in Windows XP -it used to?