HTTPService and string value.
We are having an unexpected issue in our application. One of
the tags returned by a HTTPService is:
<lot_code>7E00024</lot_code>
And we bind this to a data grid column using:
<mx:DataGridColumn headerText="Lot Number"
dataField="lot_code"/>
But the value displayed is:
7e+24
So Flex is automatically converting it to a number and
showing in exponential format. How do we define the XML so we force
a value to be "string" or "text"?
Thanks in advance.
Hi
How are you receiving your data?
as E4X, XML, OBJECT?
That is important, because for instance if it comes like xml
you can use a tostring() to get a node like a string, check de
documentation about XML on adobe livedocs
Similar Messages
-
How to send byte array and String values to servlet from Swing application
Hi all,
I am new to swing, servlet, and socket connection.
I have swing application to draw images and some input data. I dont know to send to server.
byte[] buf = baos.toByteArray();
URL servletURL = new URL("http://10.70.70.1:8080/servlet/SaveImage)
URLConnection conn = servletURL.openConnection();
conn.setDoOutput(true);
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( conn.getOutputStream() ) );
out.write(buf&a=aaaa&b=bbbbb);
out.flush();
out.close();
can I do like this. Strings are received in server side perfect. but i cant get byte array data. Please help me.
Thanks in advance.<img src="myservlet">
In your myservlet:
response.setContentType("image/jpeg");
then write your image date via ImageIO that uses response output stream. -
How to Sort JTable data using Multiple fields (Date, time and string)
I have to fill the JTable data with some date, time and string values. for example my table data looks like this:
"1998/12/14","15:14:38","Unicorn1","row1"
"1998/12/14","15:14:39","Unicorn2","row2"
"1998/12/14","15:14:40","Unicorn4","row3"
"1998/12/17","12:14:12","Unicorn4","row6"
Now the Sorted Table should be in the following way:
"1998/12/17","12:14:12","Unicorn4","row6"
"1998/12/14","15:14:40","Unicorn4","row3"
"1998/12/14","15:14:39","Unicorn2","row2"
"1998/12/14","15:14:38","Unicorn1","row1"
ie First Date field should be sorted, if 2 date fields are same then sort based on time. if date and time fields are same then need to be sorted on String field.
So if any one worked on this please throw some light on how to proceed. I know how to sort based on single column.
But now i need to sort on multiple columns.So what is code change in the Comparater class.
Thanks in advance.. This is urgent....I think your Schedule objects should implement Comparable. Then you can sort your linked list using the Collections.sort() method without passing in a Comparator.class Schedule(Date date, String class) implements Comparable
public void compareTo(Object obj)
Schedule other = (Schedule)obj;
return date.getTime() - other.getDate().getTime();
} -
Date from a string and int value in ssis
hi so my table is as follows
active expirymonth
expiryyear
0 October 2014
0 February 2015
1 January 2012
and so on
now my requirement is that if active =0 then in a new table lets say LASTDATE and they want a date with the last day of the expiry month and year and if active is anything else write NULL for eg
LASTDATE
10/31/2014
02/28/2015
NULL
I went to derived tables and made a new table called lastdate. What expression do i build in the expression builder to get the required result as i could not find a way to convert the text into int and then into a dateHi Bharatb111,
If you want to achieve this using Derived Columns transform, you have to use following expression to first convert the month name value to integer:
([expirymonth]==”January”)?1:([expirymonth]==“February”)?2: ([expirymonth]==”March”)?3:([expirymonth]==“April”)?4:5
However, if we need to validate a couple of or even all of twelve months, the expression validation will be failed. So, the Derived Column approach is impossible.
To achieve your goal, you can use a Script Component to perform the date format conversion. This way, we can convert “dd/MMMM/yyyy(such as “01/October/2014”) format string value to “MM/dd/yyyy” (such as “10/01/2014”), and assign this value to a new output
column (assuming its name is “DateVal” and its data type is DT_DATE) of the Script Component. Then, we can drag a Derived Column under the Script Component and connect them. In the Derived Column, we can add a new column named “LASTDATE” with the following
expression:
([active]==0)?DATEADD(“d”,-1, DATEADD(“Month”),1,DateVal]):NULL(DT_DATE)
For the Script Component code snippet, please refer to Reza’s answer:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1661339c-252c-4197-9cfd-943e1d86b573/convert-a-string-to-date-format?forum=sqlintegrationservices
Hope this helps.
Regards,
Mike Yin
TechNet Community Support -
Find and replace value in Delimited String
Hi All,
I have a requirement, where i need to find and replace values in delimited string.
For example, the string is "GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~". The 4th column gives month and year. I need to replace it with previous month name. For example: "GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~". I need to do same for last 12 months.
I thought of first devide the values and store it in variable and then after replacing it with required value, join it back.
I just wanted to know if there is any better way to do it?for example (Assumption: the abbreviated month is the first occurance of 3 consecutive alphabetic charachters)
with testdata as (
select 'GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~' str from dual
select
str
,regexp_substr(str, '[[:alpha:]]{3}') part
,to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY') part_date
,replace (str
,regexp_substr(str, '[[:alpha:]]{3}')
,to_char(add_months(to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY'),-1),'MON')
) res
from testdata
STR
PART
PART_DATE
RES
GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~
FEB
02/01/2013
GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
with year included
with testdata as (
select 'GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~' str from dual
select
str
,regexp_substr(str, '[[:alpha:]]{3}-\d{2}') part
,to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY') part_date
,replace (str
,regexp_substr(str, '[[:alpha:]]{3}-\d{2}')
,to_char(add_months(to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY'),-1),'MON-YY')
) res
from testdata
STR
PART
PART_DATE
RES
GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
JAN-13
01/01/2013
GL~1001~157747~DEC-12~CREDIT~A~N~USD~NULL~
Message was edited by: chris227 year included -
Help to search for a string value and return the index in the arraylist
Hello,
I just start java programming for the last three weeks and I cannot find a solution for this problem. I have the following List with string and integer value as shown below:
List<Empl> list= new ArrayList<Empl>();
list.add(new Empl(1,"Jim", "Balu",88);
list.add(new Empl(3,"Bob", "Howards",2);
list.add(new Empl(2,"Chris", "Hup",8);
I have no problem of sorting this arraylist either by firstname or lastname. However, I cannot think of a way to search for a firstname or lastname and returing the whole row. I do not want to use index since I am asking user to enter the name to search. Here is my code to search for an empl based on index.
System.out.print("Please enter index to search or (q)uit: ");
String ans = sc.next();
System.out.println();
int ians = Integer(ans);
if (ans.equalsIgnoreCase("q"))
choice = "n";
else
System.out.println("index " + list.get(ians)); //this will print out the whole row based on the index
Since the user will never seen the contents of the arraylist, is there a way that I can search by string last/first name and will get the index location in int if the result is met?
Please advice and thank you.
Bob.user11191663 wrote:
Since the user will never seen the contents of the arraylist, is there a way that I can search by string last/first name and will get the index location in int if the result is met?Another possibility is to set up an ArrayList for each thing you want to search on and then every time you add an employee, add the piece of data you want as well, viz:
Empl e = new Empl(1,"Jim", "Balu",88);
list.add(e);
firstNames.add(e.firstName());As long as you always add them in the same order, the indexes will match, so you could do something like
ians = firstNames.indexOf(nameToFind);to return the index of the name, if it's there (if not, it will return -1).
I wouldn't recommend this as standard practise, but it should be OK for the level you're at.
NOTE: indexOf() returns the index of the FIRST matching item. You may want to think about what you want to do if there are more than 1.
Winston -
I have metadata whose value is 'true' but the corresponding enum title is not being displayed. If I set it explicitly to 'true' it will be displayed even though the value is the same as it was.
Likewise for 'false'.
I do not have this problem with enums that have any other string values i.e. 'yes' and 'no' function properly, but 'true' and 'false' do not.
RobDue to better understanding on my part, and the fixes in Beta 2.2, the
issues raised in this thread are put to rest.
Abe White wrote:
>
We'll investigate further. Stay tuned...
"David Ezzio" <[email protected]> wrote in message
news:[email protected]..
Abe,
Actually, it doesn't make sense. The first iteration shows
jdoPostLoad is called just prior to using the fields of Widget and Box.
After the commit, the instances are not cleared. So far, so good.
In the second iteration, we see that jdoPreClear is called, but
jdoPostLoad is not called. Yet the values are there for use during the
call to Widget.toString() and Box.toString() within the iteration. How
did that happen?
On the third iteration, now the value of name is null, but last we
looked it was available in the second iteration. Other than that, I
agree that the third iteration looks ok, since it is being cleared and
loaded prior to use. But in the jdoPreClear, the values should be there
since the values were used in the previous iteration and are not cleared
at transaction commit due to retainValues == true.
David
Abe White wrote:
David --
I believe the behavior you are seeing to be correct. Section 5.6.1 of
the
JDO spec outlines the behavior of persistent-nontransactional instancesused
with data store transactions. As you can see, persistentnon-transactional
instances are cleared when they enter a transaction; thus the calls to
jdoPreClear. When the default fetch group is loaded again (like whenyou
access the name of the widget) a call to jdoPostLoad is made.
You are seeing the name of one instance as 'null' in the third iterationof
your loop because the instance has been cleared in the second iteration,and
the jdoPreClear method is not modified by the enhancer (see section10.3).
Make sense? -
UCCX 8.5.1 - Expression editor and a variable string value error
I receive the followng error when trying to create a varialbe string value using the expression editor. The string value that I am trying to create is used with the Create URL Document Object. The popup error states 'Unable to parse expression: Couldn't repair and continue the parsing on token #ID 'FindCaseByCaseNumber' (line 1, col:24)' The string value is "<Message MessageType="FindCaseByCaseNumber" Source="APIMessage" ReferenceNumber="1" NodeID="1" UserID="1"><CaseNumber>"05-CP-001842"</CaseNumber></Message>". The editor will not let me save the string value with quotation marks being used in the string value, exampe "FindCaseByCaseNumber". When I remove the quotation marks from the string value the editor will save the value but then the variable will not work.
Has anyone encountered this same problem or know what to replace the "" to terminate the string value? I have tried brackets, but this does not work. Any suggestions are greatly appreciated!I found my answer. It appears that ${}, #{}, and ' will let you add a sub-variable to a variable string value.
-
String values changing when compiling, preverifying and packing apps.
I have an app that uses commands. The command text values I pick from String array, that contains all the values for various Commands. This is done for making it easier to change languages in the app.
The problem is that vhen I pack the app, these string-values might be changed. Characters that are bit more exotic.. (like spanish letters with ' or ~ on top of the character on various european characters with dots are converted something else.
At the moment I just initialize these Strings like
String text = "Do this";Any ideas how to avoid this conversion..
P_sThanks, that did the trick. And after little googling around I found this nice table to cover the codes as well.
http://www.cs.tut.fi/%7Ejkorpela/latin1/1.html
P_s -
ResultEvent object is reversing my string values. Why?
Hello
Here is another wacky problem I am facing, maybe someone here can clarify or shed some light on this.
I have a web service and HTTPService object that invokes it. I get data back just fine. I noticed though, that some of the data is reversed.
Here is the raw data output, from my WSDL. This is what the Web Service really returns:
Now, here is what I get from my ResultObject:
Why is this value reversed? Is FLEX actually trying to help me by reversing this?
I now must perform a reverse string hack, which I can handle. But why would the ResultEvent be reversing string values? Just because it has a lot of period characters in it? Riddle me this Batman???I am unsure what you mean by "server".
I kind of need my server in the equation because it supplies my data via Web Service, lol. It is required.
I am not using XML either.
Test case? Do you mean to try the ArrayCollection test scenario jbf00 suggested? Or some other test case?
I havent tried it because:
1.) I dont have time, I have to many other bugs to try to fix.
2.) I am pretty sure the problem will persist in an XML object or ArrayCollection object.
Unless those objects perform string reversals magically. -
About xml and null values in 10g
Hi, I have an UCM GetFile webservice component wich receives 4 arguments, two of them are null values (rendition and extraPops), and the xml request generated by obpm is:
<GetFileByName xmlns="http://www.stellent.com/GetFile/">
<dDocName>V_123410</dDocName>
<revisionSelectionMethod>latestReleased</revisionSelectionMethod>
<rendition/>
<extraProps/>
</GetFileByName>The problem is: On UCM web service, an empty tag like <rendition/> is treated like a "empty string" value, instead of a null value, and then the response i get isn't the expected.
What I want do to is change this behavior, and when I put null values in requests, the obpm should not write those tags. Is that possible?
Should be like that:
<GetFileByName xmlns="http://www.stellent.com/GetFile/">
<dDocName>V_123410</dDocName>
<revisionSelectionMethod>latestReleased</revisionSelectionMethod>
</GetFileByName>Thanks!Hi,
I have question regarding aggregates. It's possible to read data from BW aggregates? We have webi reports on a SAP BW multi cube and we would like to optimize retriving query.
>> Because you are using the BW Query as the source all the items that you have done so far in terms of aggregation, indexing, ... is all valid and there are no specific steps required to leverage it with Web Intelligence. Make sure the aggregates are "correct" meansing that they do reflect what you are asking for in the Web Intelligence query panel
How can we filter in webi query null (#) values. If we create condition that some variabe is diffrent from # we still get null (#) values in report.
>> You should be able to create a variable. in case you tried that already could you be more specific ?
thanks
Ingo -
Difference between String=""; and String =null
I want to know the difference especially the ADVANTAGE between the following-
1. String s="";
String s="ABC"
and
String s;
String s="ABC";
or String s=null;
String s="ABC";
2. Object anyObject;
anyObject-new Object();
and
Object anyObject=null;
anyObject=new Object();Tanvir007 wrote:
I want to know the difference especially the ADVANTAGE between the following-
1. String s="";s points to the empty string--the String object containing no characters.
String s="ABC"s points to the String object containing the characters "ABC"
String s; Declares String reference varialbe s. Doesn't not assign it any value. If it's a local variable, it won't have a value until you explicitly assign it. If it's a member variable, it will be given the value null when the enclosing object is created.
String s="ABC";Already covered above.
or String s=null;s does not point to any object.
String s="ABC";???
You've already asked this twice.
Are you talking about doing
String s = null;
String s = "ABC";right after each other?
You can't do that. You can only declare a variable once.
If you mean
String s = null;
s = "ABC";It just does what I described above, one after the other.
2. Object anyObject;
anyObject-new Object();
and
Object anyObject=null;
anyObject=new Object();As above: In the first case, its value is undefined until the new Object line if it's a local, or it's null if it's a member.
As for which is better, it depends what you're doing. -
How to get string value from xml in JSF??
In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF
Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization. -
Hi Guys,
I am using DB2 database in SSRS. I have to pass Single Value and Multi Value Parameters. I tried with Select * From DB2Table Where
Column=@PRM_Name Or Select * From DB2Table Where
Column=:PRM_Name . It is not working and throwing error. Please help me out.
Connection Details: ODBC
Thanks Shiven:)Hi SKM,
So you mean to say that Go to DataSource->Add Dataset-> Query Type-Text-> Under Query:
click on fx (Expression)-> Write this expression
For Single Value Parameter:
="SELECT customer_name, telephone_number, address1, address2, city from MyTable
WHERE city = '" + Parameters!City.Value + "'"
OR
="SELECT customer_name, telephone_number, address1, address2, city from MyTable
WHERE city = '" & Parameters!City.Value & "'"
Keep it in mind if Parameter is String then
It should be in Single quote ''.
Like
="SELECT customer_name, telephone_number, address1, address2, city from MyTable WHERE city
='Hyderabad' "
For Multivalu Parameter:
="SELECT EmployeeID, FirstName, LastName, LoginID FROM SHIVEN.AUDIT Where FirstName
in ('" + REPLACE(JOIN(Parameters!City.Value,","),",","','") + "')"
NOTE:
If your Parameter is Single Value Parameter and You want to enter string values with Coma (,)
separated (Like Hyderabad, Chennai, Delhi).
In this case, you have to use below expression.
="SELECT customer_name, telephone_number, address1, address2, city from MyTable
WHERE city IN ('" + REPLACE(Parameters!City.Value ,",","','") + "')"
OR
="SELECT customer_name, telephone_number, address1, address2, city from MyTable
WHERE city IN ('" & REPLACE(Parameters!City.Value ,",","','") & "')"
In above expression: Replace will replace all , with ‘,’ and city IN (‘Hyderabad’, ‘Chennai’,
‘Delhi’) will not throw any error.
Note: You have to write expression in one line in Expression editor for dataset
query
Thanks It is working fine but it is tough job if query is big.
Hi S kumar,
The above approach we use when we have source like DB2, becasue DB2 has some syntactical differences to pass multivalue paramaeter. I tested and it works good, if i am mentioning the query in above format by using Fx button while creating dataset.
but if we want fetch data from view which exist in DB2 and we need to call db2 view in SSRS and pass multivalue parameter in a way we did above then could you please mention the steps and way to achieve this.
Thanks in advance! -
How can I compare the actual and expected values in Unit testing when they are XML files?
I have created a unit test for a method in VS 2008. My expected value and actual value are XMLs. Therefore though the output is same as I expect it gives an error as I am doing string comparison now. How can I compare these 2 XMLs in expected output and
actual output format in Unit Testing?
mayooran99In unit test, when you want to validate XML files, you feed them into the class / struct that you want to feed the XML into and compare the values there (You don't just feed it in XMLReader and feed it line by line, right? But if it really is, that's how
you should also test it in unit tests).
In short, how you'd use the XML in your code, that's how you should test it in unit test.
Maybe you are looking for
-
Help! UI mountain lion installation
Hi All (Updated) I have a mac mini (circ. 2010). its UI becomes non-responsive after it wakes up displays from sleep. The UI seems frozen. When the displays are asleep, moving the mouse or punching the keyboard wakes the displays up. (I have two) Whe
-
I am trying to use below API: PMString tableName = "myTable"; ErrorCode error = Utils<Facade::IPageItemNameFacade>()->SetUserAssignedPageItemName(tableUIDRef, tableName); But this is not setting up the table name, also I am getting error = 1. Also, I
-
Moving from Lightroom to Aperture
I've had Lightroom running on my iMac, but am looking at moving to Aperture on the quick recommendation of a pro photogapher friend. I haven't upgraded LR along the way, and so I'd be looking at buying the full program, which is more expensive than
-
Adjusting the animation speed from outside javascript
Is it possible? i want to speed up the animation if, lets say, someone clicks on a menu item an the visible viewport is at the end of the animation. I found a variable called "pixelperms" in the edge.js but i don't know how to acces it. Help highly a
-
Leopard on an Intel Mac and ID CS2
Have a client who will be upgrading her 2004 iMac G5 and needs to continue using ID CS2 for just a bit longer. Is this possible or must she upgrade InDesign as well? Thanks