These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Field type handling

ebbo1983
Registered: Mar 16 2009
Posts: 93

UPDATE: Please go to post 2!

My Product Information:
LiveCycle Designer, Windows
ebbo1983
Registered: Mar 16 2009
Posts: 93
Bump, let me revise this question (the situation has changed):

Please see image, much easier to understand this way!

[img]http://docs.google.com/File?id=dcj7tdvs_22dfs2zvg5_b[/img]

Column A and B are imported via an excel file.

Column A is a TEXT field (otherwise the £ symbol will not import)
Column B is a Numeric field

and Column C is A x B using the equation:

this.rawValue = stock_t1.rawValue * market_price_t1.rawValue;

Notice that I have 4 rows imported and the last row completes the calculation even though the "260" is a text item. but the 1st 3 rows fail. The only difference being that the first 3 rows contain a £ symbol.

What i would like to do is adjust this Calculation script for Column C so that the calculation will ignore the £ sign in Column A (IF one exists) and thus completing the calculation.

NOTE: the £ symbol should still be visible in Column A, only the calculation in column C should ignore it.

Please can some1 help me with the code for this!!?
ebbo1983
Registered: Mar 16 2009
Posts: 93
anyone able to help at all?
ebbo1983
Registered: Mar 16 2009
Posts: 93
bring up my post, still need help pretty please
ebbo1983
Registered: Mar 16 2009
Posts: 93
still in search for an answer, if anyone could help me it would be greatly appreciated
ebbo1983
Registered: Mar 16 2009
Posts: 93
bump
Freelancer
Registered: May 26 2009
Posts: 71
Hi,

I do not understand why you have 'hard coded' that currency symbol?
Use text field properties to format fileld as number, use numeric value and a currency symbol as £!
Then you will get rid of that problem.

Freelancer

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.

ebbo1983
Registered: Mar 16 2009
Posts: 93
Because the data is imported from an excel file, that particular column will import currencies (£2600.00) AND numbers (260.00) from excel.

Im not quite sure what you are saying but...

I have already tried setting the field to a numeric field. This causes a problem as it imports "0" from excel as it does not understand the '£' symbol and is expecting a number.
Freelancer
Registered: May 26 2009
Posts: 71
So, I think you should get rid of that Excel £ and just take those numeric values.
How you are taking those values from Excel into PDF? C&P? VBA?Freelancer

If I had 8 hours to chop down a tree, I'd spend 6 sharpening my ax. -- Abraham Lincoln --

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.

ebbo1983
Registered: Mar 16 2009
Posts: 93
i cant, thats the whole point. I need to import with £'s or without £'s. Thats why I have set it to a text field. I know the text field works in the multiplication as long as the £ is ommitted when doing the calculation - hence my question and why I need help.

The Values are taken from Excel using a ODBC connection and some code to bind the data to the correct fields.

Is anyone able to help me, im sure its such a simple thing....
Freelancer
Registered: May 26 2009
Posts: 71
Have you found the solution?
try the substring method to return the rest after £ ...
and maybe parseInt or parse Float...

Freelancer

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.

ebbo1983
Registered: Mar 16 2009
Posts: 93
no i haven't found a solution, I will google substring to see if i can find anything useful...thanks for your help
ebbo1983
Registered: Mar 16 2009
Posts: 93
hello can some1 help me with the javascript for this, at the moment I have:

this.rawValue = stock_t1.rawValue.substring(1)* market_price_t1.rawValue;

which works aside from the fact row 4 calculation is wrong as it also ignores the number '2' in the "260" value. I need to modify this so it only skips £ symbols.

something like:

If (stock_t1 starts with £)

then

this.rawValue = stock_t1.rawValue.substring(1)* market_price_t1.rawValue;

else

this.rawValue = stock_t1.rawValue * market_price_t1.rawValue;

can anyone help with this?

also I have a problem using this method as i get a bunch of errors on all the empty rows (row 5 onwards are empty so javascript seems to be having a panic attack)

stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[4]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[4]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[5]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[5]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[6]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[6]:tvos_t1[0]:calculate
ebbo1983
Registered: Mar 16 2009
Posts: 93
ok I have updated my code:

if (stock_t1.rawValue.substring(0,1) == "£") {this.rawValue = stock_t1.rawValue.substring(1)* market_price_t1.rawValue;}else {this.rawValue = stock_t1.rawValue * market_price_t1.rawValue;}

again it works but I have the problem that rows 5-7 contain no values so produce this error, can I get around this?

stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[4]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[4]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[5]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[5]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[6]:tvos_t1[0]:calculate
stock_t1.rawValue has no properties
1:XFA:form1[0]:table_1_rows[6]:tvos_t1[0]:calculate

Is there a Formcalc equivalent?