Commas in text fields...
I have a couple fields where people enter some numbers and
then calculations are done (behind the scenes), and a resulting
number appears in a new field. I need to know how to get commas to
appear in the appropriate places (for instance - if someone's
result was 82746, I'd want it to appear as "82,746" as opposed to
"82746")...
Here is a link to download my .FLA that I am working on. The
code in question is on Frame 5. Thanks!:
http://al-i.anixter.com/TEMP/pie2.fla
--Hoffman
I didn't even think of negative numbers... And I wasn't
necessarily going
for shortness either. But, since you mentioned it. This is
both shorter, and
handles negative numbers:
function commatize(theString:String):String {
var numOut:String = "";
var l = (theString.indexOf(".") != -1) ?
theString.indexOf(".") :
theString.length;
numOut += theString.substr(l, theString.length - l);
while (l > 3) {
numOut = (theString.substr(l - 4, 1) != "-") ? "," +
theString.substr(l -
3, 3) + numOut : theString.substr(l - 3, 3) + numOut;
l -= 3;
return theString.substr(0, l) + numOut;
Dave -
Adobe Community Expert
www.blurredistinction.com
www.macromedia.com/support/forums/team_macromedia/
Similar Messages
-
How to add comma and dollar sign that places automatically in input text field
I have this ROI calculator which has several text input field
on frame one with calculate and reset buttons. When a user enters
numerical values in the text field, and jumping to the next field,
I want the input text filed be updated with dollar sign and with
comma.
Next when they hit "ENTER" key or click "Calculate ROI"
button, all the input text fields on frame 2 as a result of
calculations be updated with dollar sign and comma. I also need
that once the comma sign is assigned then it would not add any more
even if user presses the button. Can someone help me in
this?If you want to Set the Comma when you Switch to next Text
Field
Use onKillFocus / onSetFocus Functions.
to restrict multiple comma, Before Adding comma use
myText.text =
myText.text.split(",").join("").split("$").join("");
So this will give you the value without Comma and Dollar
symbol, Now add the Comma and dollar.
or you need to use a Flag for onChange Event. -
Calculated formula for replacing a comma with a Semicolon in a text field
I need help replacing a comma with a Semicolon in a text field.
I have a field that has names separated by commas.
Ex: Dog, Cat, Bird, Horse, Eagle, Worm, Snake
I would like a calculated column that converts the field into: Dog; Cat; Bird; Horse; Eagle; Worm; Snake
I figured out the first three positions (Dog, Cat, Bird,) but I can't figure out the rest.
Using the formula below.
=REPLACE((REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1"," ; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; ")),SEARCH(",",(REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1","
; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; "))),"1"," ; ")
Please helpcheck the similar post
http://social.technet.microsoft.com/Forums/windowsserver/en-US/66e2ae2a-4da9-4c58-a8bb-cf46b1bf448f/calculated-column-to-replace-commas?forum=sharepointgenerallegacy -
Here's the problem. I have a text field called Manager in an InfoPath 2010 form that is getting populated by a drop down field called
Business Unit.
The Business Unit drop-down field is pulling information from
column A in a custom list via a managed data connection. The custom List has two columns:
Title & Manager.
The Manager column in the custom list is a 'Person or Group' type column.
The Data Connection pulls both the Title, Manager
(and ID) data.
There is a rule on the Business Unit drop-down field to change the value of the
Manager text field with the Manager data on the custom list. The rule pulls the
Manager information and filters the value to match the
Business Unit on the Data Connection with the Business Unit drop-down
field value (Main).
The Business Unit drop-down field works great and pulls the value from the custom list, and the rule populates the Manager text field. The problem is that Manager text field shows the name as such:
[smith,, john]. Notice the two commas between the last and first name. There should only be
one comma!
Anyone have an idea why the text field is appearing with two commas?
ArnelHi all,
I have a workaround for this. I have an InfoPath 2010 form pulling data from a SP2010 list. The user chooses a System (Business Unit) from the dropdown list and that choice auto populates the associated user (Manager) for that system. I had to
use concatenation, substring before and substring after to display the correct data.
concat(substring-before(DisplayName, ",, "), ", ", substring-after(DisplayName, ",, "))
DisplayName is the original data for the field. I am able to cut & paste this field into the formula. Therefore, I added a few spaces to separate it from the actually formula for future use.
Select Insert Function
Select concat
Select the first link to double-click to insert field
and then select Insert Function
Select the Text category and choose substring-before
Select the third link to double-click to insert field
and then select Insert Function
Select the Text category and choose substring-after
Copy and paste your fieldname (in my case DisplayName) in the
double-click to insert field
parts of the substring-before and substring-after links.
Delete the middle double-click to insert field link
Add quotes, spaces and commas so that they match the following format:
concat(substring-before(DisplayName, ",, "), ", ", substring-after(DisplayName,
Translation:
concat(substring-before(Doe,, John, ",, "), ", ", substring-after(Doe,,
John, ",, "))
Bring together all of the text before ",," (i.e. Doe) with ", " (comma, space) and all text after ",," (i.e. John).
It should return
Doe, John.
I hope this makes sense. I have these instructions with screenshots if you need them, contact me. -
Hope someone can help me.
What I basically need help with is how to make Acrobat add a comma after every 6 characters in a text field:
XXXXXX,YYYYYY, ZZZZZZ etcI'm sorry, but I did not understand that (i'm using Acrobat Pro X)
Am I supposed to go to:
Text Field Properties > Format > Custom
and then use Custom Format Script or Custom Keystroke Script?
I tried both and it did not work.
And do the Text Field have to be named "chunkSize"?
Seems like it works. I had to move to the next formfield in order to see the effect.
Is it possible to make it happen in real time (as you type the comma is inserted?) -
Data Merge, description field data with comma in text
I work with Data Merge, but my description field data have comma in text, occurring a problem when load to Indesign, when i exclud de field description with comma the action occur perfectly. Have solunction to this?
Hi Peter, i dont have problems with =concatenate on excel, and i think who you formula is wrong. i use exactly =CONCATENAR(A2&","&B2&","&C2) and works perfectly.
My problem is with commas in texts, see comma B2
indesign recognizes it as the delimiter and wraps the text to another field, ok?
i use quotes eg: B2( "Dias melhores, para sempre") to delimiter text like the example
when I load the data source InDesign does not recognize the quotes and breaks lines
the text "Dias melhores, para sempre" have to show on <<slogan>> but -
SQL to match a single value in a field with comma-delimited text
I have a column that can contain none, one or many recordIDs
(from another table) stored as comma-delimited text strings (i.e.,
a list). I need to retrieve all records that match a single value
within that list.
For example, if I want to match all values that equal
recordID 3, and I use ... WHERE MyColumn IN ('3') ... , I will get
all records that have EXACTLY 3 as the value of MyColumn, but not
any MyColumn records whose values include 3, if they are instances
such as "3,17" or the like.
Also using the LIKE operator -- as WHERE MyColumn LIKE '%3%'
-- will get me unwanted records with values such as 35 or 13 ...
Can I use some sort of intervening ColdFusion list processing
to output only the desired records?Normalize your database so that your data becomes
accessible. -
How do I 'commit' a value in a text field with GUI scripting?
I have a script to change the dates of a "Roll" in iPhoto. I can insert the text into the proper field, but it doesn't 'stick'. When I click on another item, the text field returns to the old date. If I click on the text field before I run the script, then a Tab or Return from the keyboard will set the field properly.
Do I need to programatically set the 'focus' on the field first? Without setting the focus first, a "keystroke return" is caught by the top window and either beeps or opens a photo for edit (as one might expect).
tell text field 2
set value to rDate -rDate is a string "4/30/06"
keystroke return
end tellThanks for the reply. Backstory: My iPhoto library got corrupted, so I created a new one and dragged in the old Library. The Rolls all have the date the new rolls (directories) were created; all the same in this case. Sorting the rolls by date is thus nonsensical. The AppleScript for iPhoto doesn't handle what I want to accomplish, but the UI scripting might help me out.
When the whole Library is picked, you can 'view' by "Film Rolls" and the date appears in the bar above each roll of photos. You can change the date in the "Information" area available at the lower left. (The same area you change the title of the rolls or photos, too.) I want to change the roll dates to match the photos' dates.
So I fired up UI scripting and figured out that I can fetch the date range of the photos in a roll and then set a date for the roll. I can see the date change in the text field, but it doesn't 'stick'. Only if the field has been clicked on prior to running the script, can I "keystroke return" to 'enter' the field. Otherwise I'm looking for suggestions.
Slightly off topic: The whole right side of the iPhoto screen is a big black hole for UI events. You can't tell anything about it with the UI Element Inspector. I can't automagically 'pick' anything in there, so I can't 'select' the rolls from a script. I'll settle for clicking on a roll and then running a script to correct its date.
Here's the whole script, without a bit that verifies that the 'assistive devices' box has been checked in the Universal Access pref.
tell application "iPhoto"
activate
end tell
tell application "System Events"
tell process "iPhoto"
activate
tell window "iPhoto - rebuilt Library"
tell group 1
tell splitter group 1
tell splitter group 1
tell static text 5 --either 'from' or 'date'
set theLabel to value
end tell
if theLabel is "date" then
tell static text 6
set rDate to value
end tell
else --get date from 'to' field
tell static text 8
set rDate to value
end tell
end if
tell text field 2 --roll's date
set value to rDate
keystroke return --might not work
end tell
end tell
end tell
end tell
end tell
end tell
end tell -
I need to identify a series of single-response checkbox variables and display the ones selected (as a group) in a text field in an appended (comma, space) format. Last week, you provided a great little script for a similar need using List Box (multiple response) variables. This time I need to know how to formally identify the checkbox variables and, I presume, use a similar script to display the results in a comma, space format.
You've been of great help.
ThanksHere's the script adapted to this situation. It assumes there are ten check boxes named cb1, cb1, cb2, ...cb10.
// Custom Calculate script for text field
(function () {
// Initialize the string
var v, s = "";
// Loop through the check boxes to build up a string
for (var i = 1; i < 11; i++) {
// Get the value of the current check box
v = getField("cb" + i).value;
if (v !== "Off") {
if (s) s += ", "; // Add a comma and a space if needed
s += v; // Add the selected value
// Set this field value to the string
event.value = s;
You'll have to change the field name and starting/ending numbers to match your form. -
How can i validate current row input text field like required.
Hi All,
jdev 11.1.2.1.0
in my use case i have drag drop one viewobject as a adf table. and in table i have also add one extra input text field which is not based on
vo.
now i want to validate current row input text field not null when i commit row.
but when i using required property true. it worked for all row in table. problem is that i want only current row input text field validate not all
thanks,
ManishWhen the user tries commit the data by clicking on the button -- For that button, have the logic in the actionlistener method to check if the additional input field is NULL or NOT.
If it is NULL, show an error message using FacesContext.addMessage() API.
Thanks,
Navaneeth -
How to allow input text field to accept more than one "specific" answer.
Hi,
I am working for something and trying to create a type-box-based quiz for one of my classes, where an input text field can change it's border color if 2 or more words from an accepted word list is inputed.
For example, Say a list has possible answers: R,G, B, Y for the question "Name 2 colors".
I want to create an input text box where the border of the box will change color if any 2 letters (in the above list) are entered into it.
I've tried setting up a variable NumberSuccesses and setting it so that the number increases by 1 for each letter entered e.g.
if (Ex.text == "R");
NumSuc = NumSuc +1; // the var NumSuc has already been defined earlier in the code
If (Ex.text ''G")
NumSuc = NumSuc + 1
if (NumSuc == 2)
Ex.borderColor = 0x0000FF
but that didn't work.. and I tried doing it with another function which I use for multiple input boxes like if there were boxes A, B, C. I could set up a general function where if the correct answers were entered into A, B, an C respectively, only then will say, a checkmark show up using a
EnableCheckmark (); type function. Not sure how to do it if it's the same text input box though. Also just tried adding it into the same function re.
If (Ex.text == "R" + "G")
Ex.borderColor = 0x0000FF
.. Does anyone know what else I can do?The solution of Nishu with Evaluation Logic:
//These Are the Possible Answers
var solutions:Array = new Array("A","B","C","D");
function testInput(_inputText:String):Boolean
//the delimiter could also be a comma, here it is a space
var inputStringArray:Array = _inputText.split(" ");
var counter:Number = 0;
for (var i:int=0; i<inputStringArray.length; i++)
for (var j:int=0; j<solutions.length; j++)
if (inputStringArray[i]== solutions[j])
counter++;
if (counter >=2)
trace("true");
return true;
else
trace("false");
return false;
//Textfield with name input_txt on stage
input_txt.addEventListener(TextEvent.TEXT_INPUT, answerTxtInp);
// The function that will be called by the event listener
function answerTxtInp(txtEvent:TextEvent):void
// depending on the possible answers of characters, change the border color
if(testInput(input_txt.text)){
input_txt.borderColor = 0xFF0000;
else{
input_txt.borderColor = 0x000000; -
Single or multiple check box values displayed in a text field
My apologies, this may be a duplicate discussion.
I'm using the following script to display the values of check boxes in a text field. I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and". Example of two check boxes selected: A and B. Example of two or more: A, B, C, and D. Can this be done?
form1.page1.page1SF.programs::calculate - (JavaScript, client)
//displays the values of check boxes named programCB
var aChkBx = [];
var vChecks = programCB.all;
for (var a=0; a<vChecks.length;a++){
if(!vChecks.item(a).isNull) {
aChkBx.push(vChecks.item(a).rawValue);
this.rawValue = aChkBx.join(", ");My apologies, this may be a duplicate discussion.
I'm using the following script to display the values of check boxes in a text field. I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and". Example of two check boxes selected: A and B. Example of two or more: A, B, C, and D. Can this be done?
form1.page1.page1SF.programs::calculate - (JavaScript, client)
//displays the values of check boxes named programCB
var aChkBx = [];
var vChecks = programCB.all;
for (var a=0; a<vChecks.length;a++){
if(!vChecks.item(a).isNull) {
aChkBx.push(vChecks.item(a).rawValue);
this.rawValue = aChkBx.join(", "); -
Hi,
I want to load a string of characters to a text field of a table. I'm using SQL Loader.
I've tried to declare the field in several types: varchar2(4000), clob, raw, etc, but when I run sql loader to load the text I get the same error: The data file exceeds maximum lenght. I've tried with a shorter text and it works.
My question is, why I can't load long characters in that field?
Thanks in advance.
Regards.Although you have made your table column up to size 4000, SQLLoader have not got a clue about that. You still need to tell SQLLoader that the text coming in is more than the default 255 in your control file. Strange isn't it?
Here is my table named testlog. Note that I changed the column names LOG, DAY, TIME and TYPE because they are reserved Words
SQL> CREATE TABLE TESTLOG
2 (LOG_1 CHAR(3) NOT NULL,
3 DAY_1 DATE,
4 TIME_1 CHAR(8),
5 SOURCE VARCHAR2(100),
6 EVENTID NUMBER(22),
7 TYPE_1 VARCHAR2(64),
8 CATEGORY VARCHAR2(64),
9 USER0 VARCHAR2(64),
10 COMPUTER VARCHAR2(64),
11 MESSAGE VARCHAR2(4000) NOT NULL)
12 /
Table created.
SQL> desc testlog
Name Null? Type
LOG_1 NOT NULL CHAR(3)
DAY_1 DATE
TIME_1 CHAR(8)
SOURCE VARCHAR2(100)
EVENTID NUMBER(22)
TYPE_1 VARCHAR2(64)
CATEGORY VARCHAR2(64)
USER0 VARCHAR2(64)
COMPUTER VARCHAR2(64)
MESSAGE NOT NULL VARCHAR2(4000)
SQL> select * from testlog;
no rows selected
SQL>
I saved the same data you have abvoe in a file named testlog.txt Here is my test controlfile named testlog.ctl
LOAD DATA
INFILE 'testlog.txt'
INTO TABLE testlog
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
LOG_1 CHAR NULLIF (LOG_1=BLANKS)
, DAY_1 DATE "DD/MM/YYYY" NULLIF (DAY_1=BLANKS)
, TIME_1 CHAR NULLIF (TIME_1=BLANKS)
, SOURCE CHAR NULLIF (SOURCE=BLANKS)
, EVENTID INTEGER EXTERNAL NULLIF (EVENTID=BLANKS)
, TYPE_1 CHAR NULLIF (TYPE_1=BLANKS)
, CATEGORY CHAR NULLIF (CATEGORY=BLANKS)
, USER0 CHAR NULLIF (USER0=BLANKS)
, COMPUTER CHAR NULLIF (COMPUTER=BLANKS)
, MESSAGE CHAR(4000) NULLIF (MESSAGE=BLANKS)
Here is the Result of my test run
D:\DBMSDIRECT\DBA\Test>sqlldr userid=test control=testlog.ctl
Password:
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 5 15:36:05 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 1
D:\DBMSDIRECT\DBA\Test>
Here is the Result in the table
SQL> col message format a50
SQL> col source format a50
SQL> col category format a10
SQL> col source format a10
SQL> col user0 format a10
SQL> col type_1 format a10
SQL> col computer format a10
SQL> set pasge 20
SQL> select * from testlog;
LOG DAY_1 TIME_1 SOURCE EVENTID TYPE_1 CATEGORY USER0 COMPUTER MESSAGE
SEC 04-NOV-10 12:26:02 Microsoft- 4656 Success 12800 server1.it A handle to an object was requested.^`^`Subject:^`
Windows-Se acasa-sa.c Security ID: S-1-5-21-3830471607-3036766313-42914
curity-Aud om 15205-2156^` Account Name: mbelles^` Account Domai
iting n: ITACASA-SA^` Logon ID: 0x38988bbc^`^`Object:^`
Object Server: Security^` Object Type: File^` Obje
ct Name: K:\AMBIENTE^` Handle ID: 0x1e18^`^`Proces
s Information:^` Process ID: 0x4^` Process Name: ^
`^`Access Request Information:^` Transaction ID: {
00000000-0000-0000-0000-000000000000}^` Accesses:
%%4416^` ^` Access Mask: 0x1^` Privileges Used for
Access Check: -^` Restricted SID Count: 0
1 row selected.
SQL> -
Can't get a text field to atuo populate based upon a dropdown selection
I have a drop down box with 3 values that can be selected:
Dropdown2 = 101-3 subd.A
101-3 subd.B
101-3 subd.C
I am trying to get a text field to auto populate based upon the selection:
if Dropdown2 = 101-3 subd.A then Text4 = "ValueA"
if Dropdown2 = 101-3 subd.B then Text4 = "ValueB"
if Dropdown2 = 101-3 subd.C then Text4 = "ValueC"
I have tried to create a custom calculation script for Text4:
var v= getfiled("Dropdown2").value;
if (v="101-3 subd.A") event.value = "ValueA";
else if (v="101-3 subd.B") event.value = "ValueB";
else if (v="101-3 subd.C") event.value = "ValueC";
else event.value = " ";
I have entered this script and the syntax appears to be correct.(At least to Acrobat XI. I'm know programmer and have just enough knowledge to be dangerous). When I select a value in Dropdown2 nothing happens. No value appears in Text4. I have checked the "commit selected value immediately" in the option of Dropdown2 per some google'ing. I just can not understand why the values do not appear. Any help would be appreciated.
ThanksI made the changes and added the == to my if statements. When I select a value in Dropdown2, Nothing appears in Text4. I don't understand. Is there something else that I need to do beside event.value="Some Value";?
I know it has to be something simple that I am missing, but I just can't seem to see it.
Text4 - Custom Calculation Script:
var v= getfiled("Dropdown2").value;
if (v=="101-3 subd.A") event.value = "ValueA";
else if (v=="101-3 subd.B") event.value = "ValueB";
else if (v=="101-3 subd.C") event.value = "ValueC";
else event.value = " "; -
How to handle carriage return/linefeed embedded in text field as first char
Hi,
I am trying to use sqlldr to import text that is comma-separated and double quote-enclosed, but contains embedded carriage return/linefeed pairs. I have a control file which works for most cases and looks like this:
LOAD DATA
INFILE './foo.new'
APPEND
CONTINUEIF LAST PRESERVE (<>'"')
INTO TABLE <tablename>
FIELDS TERMINATED BY "," ENCLOSED BY '"'
TRAILING NULLCOLS
Unfortunately, this fails when the very first character of the text field is a carriage return/linefeed pair, e.g.,:
"11","22","33","\r\nThis is the fourth field","","","","",""
In that case, what is actually the opening double-quote for the fourth field, is interpreted by the CONTINUEIF clause as the end of that line. Can anyone please point me to a solution?
thanks.
stan.Thanks for the suggestion. Unfortunately, I've already tried it, and it doesn't help. I believe the problem is that sqlldr tries to figure out where each record is delimited before it parses out the field. So, any field-level trimming depends on sqlldr first determining that the cr/lf is actually part of that record, and not an indication of the start of a new record (and it's doing the latter right now). Fwiw, Python's csv parser will handle this type of record just fine.
regards.
stan.
Maybe you are looking for
-
Defective ink cartridge?
I have a F380 all-in-one. I've had it a while and everything has been fine, but a few days ago, I tried to print a page and it cut off a rectangular portion of the top left of the page. The rest printed fine. Since then, I can't print anything. Once
-
Auto refresh when opening a workbook
Hi When I open a workbook, I would like the query to auto refresh. In that way the planning user will see the latest planning values and not the ones saved in the workbook. Is there any functionality for running the planning function refresh automati
-
How to log an issue in solman system through satellite system
Hi all, Please this is very urgent. My functional team is doing integration testing and they want that all the errors that come during testing in satellite system(in my case development system) should be logged in Solution Manager.I have already conf
-
as instructed, i also exit firefox using the drop-down menu and the cute little app tabs still disappear.
-
How to format a list of addresses in Address book
I frequently have lists of email addresses that I want to use to send emails to multiple people without setting up cards for each one in Address book. I cannot find a format for the list that works. The last person in the list always generates an err