Remove 0 Value in Calculated Field
I copied the below question for another post here as it asks the question perfectly.
"I set up an invoice form to calculate totals from quantity x unit price. Every line has this formula, however the users may not have a priced item on every line of the form. My total column shows a $0.00 value until I input data. I'd rather have nothing show in that column unless quantity and price are entered. Is that possible?"
However, and I apologize, but I don't understand the answer that was posted. This is the first time I've needed a calculated field -- and I've not done scripting in Acrobat before.
Can someone walk me through the exact steps of how to enter and what to enter in the form to remove "0" values from the form?
Thanks, in advance, for any and all help.
Thanks, again, so much. I think I got it, the procedure that is! But, but the 0 is still there.
This does now sound like a simple thing if you know the code. But apparently I'm not there yet!
This is what I did.
Under Advanced, Document Processing, JavaScript Functions.
Entered two different scripts, as follows (this is exactly how I entered them):
SCRIPT 1
Name: ds_format
Script:
function ds_format()
if (+event.value) {
//$ format for nonzero values
AFNumber_Format(2,0,0,0,"$",true);
} else {
//Don't show anything if result is zero event.value="";}
SCRIPT 2
Name: ds_keystroke
Script:
function ds_keystroke() {
AFNumber_Keystroke(2, 0, 0, 0, "$", true);
Then, under the calculated field properties (in my case, Total Cost),
Format Tab, Custom Format, Custom Format Script section, I selected edit and typed in:
ds_format();
Ditto above, but under Custom Keystroke Script:
ds_keystroke();
Similar Messages
-
Wrong values from calculated field (Java API)
Hi All,
Help me please solve the problem.
We have a table with calculated text field in MDM repositor. For some records the value of this field in MDM Data Manager differs from the value returned when we read record by MDM Java API.
Parameters of system:
MDM ver.: 7.1 SP10
DBMS: Oracle
OS: Linux
The issue solved. I've found error in program code :-)
I apologize for the worry.Assuming you want every field, the equivalent of "SELECT *" in SQL, you can use the RepositorySchema object to get a TableSchema, and with that get all FieldIds for the table.
If your RepositorySchema variable is rs it would be something along the lines of:
TableSchema mainTableSchema = rs.getTableSchema(mainTableId);
ResultDefinition rd = new ResultDefinition(mainTableId);
rd.setSelectFields(mainTableSchema.getFieldIds());
Hope this helps,
Greg -
How to remove numeric value in the fields of a table
Environment: SQL Server 2008R2
Tools: MSMS
Code:
a. Table Definition
USE [DLPT_CMS1_RESTORE]
CREATE TABLE [dbo].[Mocha]
[id] [int] IDENTITY(80,1) NOT NULL,
[Login_ID] [char](10) NULL,
[PE4] [varchar](8000) NULL,
[PE9] [varchar](8000) NULL,
[PE11] [varchar](8000) NULL,
[PE15] [varchar](8000) NULL,
[PE17] [varchar](8000) NULL,
[PE20] [varchar](8000) NULL,
[PE22] [varchar](8000) NULL,
[PE25] [varchar](8000) NULL,
[PE28] [varchar](8000) NULL,
[PE29] [varchar](8000) NULL,
[PE27] [varchar](8000) NULL
b. data
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293595,293595,293737,293737,293737,293737,293737,293737,'I dont think 12 week program is hard',293737,293737,'antiinflamatory- this helps to fight free radicals and ward off disease.')
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293841,293841,293841,293841,'293841 I feel that the product should be more holistic'
,'293841 I would like for the customer support to give more immediate feedback'
,'293841 Fends off alzeimer disease and dementia. It has been proven to destroy the amaloid plaques that are believed to be a cause of dementia and memory loss',
293841,293841,293841,293841,293841,293841)
Challenge:
1. Delete / Remove login_ids from a string found in one or more of the fields in Mocha table
Example: the following string contains login_id '293841 I would like for the customer support to give more immediate feedback' , remove the login_id in the narrative field which could be PE4, PE22. or PE28
2. Count the response or narrative field for each column after the deletion is completed
My script and still working progress
SELECT * FROM MOCHA
WHERE ISNUMERIC(PE4) = 1 and [PE4] like '%[0-9]%'
Thanks for the supportI added a new data which shows inaccurate results using your last updated code. The mistake appears in the 3rd row culomn name PE25 is null but counts it as 1
CREATE TABLE [dbo].[Mocha]
[id] [int] IDENTITY(80,1) NOT NULL,
[Login_ID] [char](10) NULL,
[PE4] [varchar](8000) NULL,
[PE9] [varchar](8000) NULL,
[PE11] [varchar](8000) NULL,
[PE15] [varchar](8000) NULL,
[PE17] [varchar](8000) NULL,
[PE20] [varchar](8000) NULL,
[PE22] [varchar](8000) NULL,
[PE25] [varchar](8000) NULL,
[PE28] [varchar](8000) NULL,
[PE29] [varchar](8000) NULL,
[PE27] [varchar](8000) NULL
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293737,293737,293737,293737,NULL,293737,NULL,293737,'I dont think 12 week program is hard',293737,293737,'antiinflamatory- this helps to fight free radicals and ward off disease.')
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],
[PE15],[PE17]
,[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293841,293841,293841,293841
,'293841 I feel that the product should be more holistic'
,'%%293841%% I would like for the customer support to give more immediate feedback'
,'%%293841%% Fends off alzeimer disease and dementia. It has been proven to destroy the amaloid plaques that are believed to be a cause of dementia and memory loss'
,293841,NULL,NULL,293841,293841)
Insert into Mocha (Login_ID,[PE4],[PE9] ,[PE11],[PE15],[PE17],[PE20],[PE22],[PE25],[PE28], [PE29],[PE27])
Values (293735,'293735 my name',NULL,NULL,NULL,NULL,NULL,NULL,'%%293735%%I dont think',293735,293735,'this helps to fight free radicals and ward off disease')
select
Replace(Replace(PE4,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE4
,Replace(Replace(PE9,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE9
,Replace(Replace(PE11,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE11
,Replace(Replace([PE15],RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE15
,Replace(Replace(PE17,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','')PE17
,Replace(Replace(PE20,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE20
,Replace(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE22
,Replace(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE25
,Replace(Replace(PE28,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE28
,Replace(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''),'%','') PE29
,(case when len(PE4)-Len(Replace(PE4,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe4] is null or Replace(PE4,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP4
,(case when len(PE9)-Len(Replace(PE9,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe9] is null or Replace(PE9,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP9
,(case when len(PE9)-Len(Replace(PE11,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe11] is null or Replace(PE11,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP11
,(case when len(PE15)-Len(Replace(PE15,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe15] is null or Replace(PE15,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP15
,(case when len(PE17)-Len(Replace(PE17,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe17] is null or Replace(PE17,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP17
,(case when len(PE20)-Len(Replace(PE20,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe20] is null or Replace(PE20,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP20
,(case when len(PE22)-Len(Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe22] is null or Replace(PE22,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP22
,(case when len(PE25)-Len(Replace(PE25,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe25] is null or Replace(PE25,RTRIM(Cast(Login_ID as varchar(10))), '') ='' Then 0 Else 1 End) cntP25
,(case when len(PE28)-Len(Replace(PE28,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe28] is null or Replace(PE28,RTRIM(Cast(Login_ID as varchar(10))), '') =''Then 0 Else 1 End) cntP28
,(case when len(PE29)-Len(Replace(PE29,RTRIM(Cast(Login_ID as varchar(10))), ''))=0 or [pe29] is null or Replace(PE29,RTRIM(Cast(Login_ID as varchar(10))), '') =''Then 0 Else 1 End) cntP29
from mocha -
How to change the column value which is coming from DO by a calculated field?
Hi all,
I want to change a column value based on my calculated field value. I have a column which is coming from DO which is based on External Data Source. I have a calculated field in my report. When there is any change in the calculated field then the column which is coming from DO needs to be changed. It means the DO needs to get updated when there is a change in the calculated field. Or like if the calculated field meets some condition then I need to change/update the same in the DO. This has to be done on the fly. the report should not submitted for this. when there is a change in the calculated column the DO column needs to get updated.
Thanks,
Venky.Ok, I've been a customer for very many years, I'm on a fixed retirement
income. I need to reduce my bills, my contract ends in Dec. I will be
pursuing other options unless I can get some concessions from Verizon. My
future son-in-law was given this loyalty plan, so I know this is a
reasonable request. My phone number is (removed) acct number
(removed)
>> Personal information removed to comply with the Verizon Wireless Terms of Service <<
Edited by: Verizon Moderator -
Custom Calculation Script to copy value of a field
Hi,
I'm trying to copy the value of a field into another field and display it in the pdf. This is for the 1099's. We are trying to print 2 copies(Copy B and Copy 2) in one page. The first field will come from the XML file. I need to copy the value of this field into the second field. Can anyone please help me with the calculation script for this. I tried the getField.value and it didn't work in the pdf. Thanks.
With Regards,
Satishpdf.Hi,
There are a couple of approaches.
One would be to put the script in the radio buttons that when clicked would do the calculate and set the value of the numeric field.
Another would be to have the script in the calculate event of the numeric field looking back at the value of the radio button. Taking this approach the script in the numeric field calculate event would look like this:
if (radioButton.rawValue == 1) // radio button bound to 1 is on/yes
this.rawValue = ; // your calculation goes here
else
this.rawValue = null;
This is testing the value of the radio button and then taking appropriate calculations.
Hope that helps,
Niall -
How to expand rows in a table by calculated value of a field
Hi,
I'm trying to set the rows of an expandable table to follow the calculated value of a field.
The calculated field comes from two date fields that calculate the number of days and I want my table/row to expand based on that number..
Is is possible? Right now I have a button that does add an instance "Admin_Use.Table3._Row1.addInstance(1);" but I want it to be triggered by the calculated field instead...
Thank you so much!!!!Hi Niall,
Thank you for your reply. I'm still a bit puzzled as right now I have this code in my calculate field (see below) under the calculated event and I'm not sure how to insert the code you sent me as I keep getting syntax errors. Any help will be greatly appreciated!!!
if (HasValue(Nights.FirstNight) & HasValue(Nights.LastNight) ) then
if (Date2Num(Nights.LastNight, "YYYY-MM-DD", "en_IE") >= Date2Num(Nights.FirstNight, "YYYY-MM-DD", "en_IE")) then
$ = Date2Num(Nights.LastNight, "YYYY-MM-DD", "en_IE") - Date2Num(Nights.FirstNight, "YYYY-MM-DD", "en_IE") + 1
else
xfa.host.messageBox ("The first night cannot be after the last night", "Nights Covered", 0)
Nights.LastNight.rawValue = null
endif
else
endif -
How to remove target node if source field value is empty SAP PI Mapping
Hello,
how to remove target node if source field value is empty in graphical Mapping.
Like if
MIddle name in source filed is empty, I would like to eliminate target field from out put XML.
Thank you
JohnHi Jhon,
If you want to remove all empty tags and you dont to complicate your message mapping, you can use a XSL, after the message mapping, to remove all the empty tags:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[not(@*|*|comment()|processing-instruction())
and normalize-space()='' ]"/>
</xsl:stylesheet>
Regards -
Copying a Calculated Field Value to another Field in the same List
Hello! I have a calculated field that uses an if statement to determine a score. IE A field called Downtime Score contains this calculate: IF Downtime Minutes =10, 100. (not correct formatting, just basic to get point across)
I simply want to use a workflow to copy the calculated value in Downtime Score (100) to another field called Final Downtime Score.
In the workflow, I current have the following: Set FinalDowntimeScore to CurrentItem:Downtime Score
When I log both to workflow history, they both show 0 in history. Nothing is copying.
The calculated field is a number and I tried both number and text fields for FinalDowntimeScore.
This is within SharePoint 2013 and using SharePoint Designer 2013.
Any help would be appreciated!Ok, I did the same test as you and it failed. I still return a 0 when I should see a 100.
Not sure if this helps but when even though we are using sharepoint designer 2013, we only have "SharePoint 2010 Workflow" available in Platform type when creating workflows.
Could you test again using SharePoint 2010 workflow as your platform type and see if you return the same results?
Thanks! -
Remove extra space value of the field in text element
Dear All,
Can any one please help me out to remove the blank spaces in the text elements of SF.
we are printing Label in which i want print quantity of material. and i am using MSEG-MENGE for quantity of maetrial.
But the issues is when we are printing the label. We are getting spaces in the Text elements fields &MSEG-MENGE&.
i am also check menge field within mseg table. in which menge field define as QUAN data type with length 13.
<
MAT CODE:&t_MSEG-MATNR&
DESC:&MAKTX&
QTY:&t_MSEG-MENGE&
UOM:&t_MSEG-MEINS&
>
My Output in SF:
MAT CODE:11000002
DESC:Coarse Aggregate 10mm Sieve
QTY: 960
UOM:LBM
MIGO.NO.:4900000025
how to remove extra blank spaces in the text elements ( QTY: 960 )
guide me.........Dear All,
I am using code block in SF before text element.
In The Text Element ...
<
MAT CODE:&t_MSEG-MATNR&
DESC:&MAKTX&
QTY:&t_MSEG-MENGE&
UOM:&t_MSEG-MEINS&
MIGO.NO.:&t_MSEG-MBLNR&
PO.NO.:&t_MSEG-EBELN&
LOCATION:&t_MSEG-WERK&&NAME1&
>
In programe Line ( code block )....
<
read table t_mseg index w_index.
qty = t_mseg-menge.
condense qty.
SELECT SINGLE name1 FROM t001w INTO name1 WHERE werks = t_mseg-werks.
SELECT SINGLE maktx FROM makt INTO maktx WHERE matnr = t_mseg-matnr.
>
My Output:
MAT CODE:11000002
DESC:Coarse Aggregate 10mm Sieve
QTY: 960
UOM:LBM
MIGO.NO.:4900000025
Only problem in value of Quantity field .
guide me......... -
Using Calculated Field in Multi Value Field
In Siebel Application
Sales Order---> List
There is a field call "Sales Rep" which displays an "USERID" of Order Sales Team Mvg Applet.
But We want to display the Last Name and First Name (combined).We got the first and last name using calculated field (Active Full name).
When I try to get the full name, the system display the name based on the "Primary position", if I step out of the particular row and come back again
Is there any way to display the full name without step out any rows for Sales Rep fieldYour description is a little confusing. For performance reasons it is always best to set the use primary join on multi value links. This means that when multi value fields are displayed in applets they always show the primary by default. If you want to display something other than the primary what is your rational behind this and why not make the record you want to display the primary?
Message was edited by:
Richard@AXA -
How to hide a calculated field if value is 0?
I want to hide a field that is calculated (sum of two other fields) and shows as 0.00 - How can I hide 0.00 until this field is calculated? I am using Adobe Acrobat Professional 8.
Thanks!You have to use a custom calculation script, something like:
// Get field values, as numbers
var v1 = +getField("Text1").value;
var v2 = +getField("Text2").value;
// Perform the addition
var sum = v1 + v2;
// Set this field value
if (sum !== 0) {
event.value = sum;
} else {
// Blank this field
event.value = "";
Or equivalently:
// Get field values, as numbers
var v1 = +getField("Text1").value;
var v2 = +getField("Text2").value;
// Set this field value
event.value = ((v1 + v2) !== 0) ? (v1 + v2) : "";
This code assumes the input fields have a numeric Format category. Replace "Text1" and "Text2" with the names of your fields.
George -
Calculated Field to return a text value
I'm trying to create a calculated field that will hit on keywords in folder names and return a value based on the keyword found. Obviously the folder name is contained in the "Name" field on my sharepoint site but how do I write a formula that
will look for a specific word or phrase and return an assigned text value?
Example: Name field contains a list of folders (see the name list below). I want the formula to search for "AAA" and return value "XYZ", I want to search for "BBB" and return value "ABC",and I want to search
for "CCC" and return a null field.
Name
Folder AAA Z
Folder BBB Z
Folder CCC Z
So we're all clear what I'm up against; right now I have a total of 45 folders (soon to be more) that I want to cut down to 5 or 6 after grouping by the returned value generated by the calculated field. I have zero experience and I'm not a formula or a code
guy. I've spent quite a few hours so far but I'm getting nowhere.Hi DKeller33
I'm gladyou were able to get it working with content types but if the calculated column
allows less hands-on maintenance I am guessing you'd probably prefer to use
that solution. So I'd like to take one more stab at it if you will bear with me
For your case, I created a new document library so I could test out the calculation.
By default there were a number of columns created.
One of them was the "Name" column which is also a hyperlink ( I beleive this is the column you are trying to use for the calculation)
There is also by default a column named "Title"
I used the "Title" column for my example because it is the same text as the folder's "Name" Column
I created a calculated field called "Calculated Group" and
added the calculation
=IF(ISNUMBER(FIND("AAA",Title)),"XYZ",IF(ISNUMBER(FIND("BBB",Title)),"ABC",IF(ISNUMBER(FIND("CCC",Title)),"","Next nested if")))
The calculated column then returned the appropriate grouping as a string so you can group or filter by it.Please let me know if you get it to work or let me know that I'm just spinning my wheels and I will stop trying.
Have a Great New Year! I hope SharePoint brings you good tidings!
Alex -
Calculating values from repeated fields.
I have a subform that repeatable, how to i calculate a value from a fields from the repeated values?
Hi,
Try using the following FormCalc code on the "total" field which is outside of your repeating row/subform:
total.rawValue = sum(form1.Page1.Row1[*].Amount[*]);
Row1 - Repeating Row
Amount - Column dedicated to Amount
Hope this helps
Thanks,
VJ -
Hi
I am using a calculated field and show it in the “view”. I can’t change it without removing all the calculated fields shown in the “view”, only removing them all I can do it and afterwards I have to put them all back
This is problem?
AlexandreWhen you go to Report | Group Sort Expert | then choose Bottom N for the sort you only have four "based on" to choose from and they are ALL simple SUMs (summary fields).
No running totals are available for TopN or BottomN due to the evaluation time of running totals. Your formula (@OEE %) isn't available as it utilizes the {Total QTY %} formula and it utilizes group sums.
Basically, as I said before, one may ONLY do TOP or Bottom N's on simple sums (summaries) of values that exist in the detail section or are calculated WITHIN the detail section. So for example, if you have a ITEM COST field and a ITEM TRANSPORTATION COST field and are grouping on customer and you want your top ten customers for total cost you can do a formula (IN THE DETAIL SECTION) that adds the ITEM COST and the ITEM TRANSPORTATION COST then you can insert a summary on that formula for the Customer group footer....then you can do a TopN or BottomN on that summary value.
But if you're calculating percentages you would have to grab totals from the report footer or group footers for the calculation to get the percentage. The fact that this is being done eliminates that value from the list available in TopN or BottomN.
Again, the only other possible method would be to write a stored procedure that pulls the values in (including percentages) then report off the stored procedure. -
in this i want to calculate only Option code 'M' Amount in gross total.BUT MY Gross total calculating M and P Amount. option code P value should visible but not to add.
please any body help me to writing any function
=SUM(IIF(Fields!OPTION_CODE.Value="M","0",Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
iam writing like below its showing error
=SUM(IIF(Fields!OPTION_CODE.Value="M","0",Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
=IIF(Fields!OPTION_CODE.Value="P","0",SUM(Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
=SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields!TOTAL_UNITS.Value), CDbl(0,0)Hi Pullela venu,
I have checked the expression and found that you have incude the string "0" in the SUM function which will cause the error, please remove the "" of the value 0 as below to have a test:
=SUM(IIF(Fields!OPTION_CODE.Value="M",0,Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
=IIF(Fields!OPTION_CODE.Value="P",0,SUM(Fields!COST.Value * Fields!TOTAL_UNITS.Value ))
For the last expression as below is not correct, CDBL function format is CDBL(expression):
=SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields!TOTAL_UNITS.Value), CDbl(0,0)
Modify as below:
=SUM(IIF(Fields!OPTION_CODE.Value="M",CDbl(Fields!COST.Value * Fields!TOTAL_UNITS.Value), CDbl(0.0) )
If the problem still exists, please provide the error message if the expression throw any error.
Any problem, please feel free to ask.
Regards
Vicky Liu
Maybe you are looking for
-
When I open a new tab, I just want it to be blank. I think it may be hijacked but I can't find how to delete/erase the internet search that pops up instead. It's called internet search and just has a magnifying glass as a logo.
-
11.1.2 64 bit on Windows 7
Hi, Has anyone faced an issue where it says "IIS is not installed" when you try to install 11.1.2 64 bit on Windows 7 x64? IIS and WWWeb Services are fine as when I call http://localhost, I can see multilingual welcome screen of IIS7. The problem occ
-
function module for hyperlink
-
Hi, I have the Design & Web Premium trial installed on my macbook pro. Can I license this trial with my creative cloud membership, or do I need to reinstall all the apps?
-
Quicktime won't uninstall or won't let me download a new version.
My computer won't let me uninstall Quicktime, its saying the file is not found but it won't let me download a new version becuase its saying another version is on my computer. Please Help!