Help with Javascript/Calculations
Hello,
Have a building use policy for school.
Need help with checkboxes and default values. I can get javascript/math to work when I click check box.
Someone wants to rent a room they check the rentRoom checkbox. Then the enter how many rooms 1,2,3 etc.. The value for the rentRoom checkbox is $25.
I can get it when the checkbox for rentRoom is selected the rentRoom.Total computes correctly. However, what I want is when the form opens up a default value of $0.00 to be in there. I also want if someone goes back and unchecks the rentRoom checkbox the value goes back to $0.00 not just blank. Right now I am getting the error the value entered does not match the value of the field. That is if I put the default value in options. Basically, I can't seem to figure out the javascript code to get this to work.
Am I asking for too much, can someone guide me to javascript to help me out.
I have tried if/then statements and switch statements. I just can't figure out how to get it to for lack of better a word - toggle back and forth.
If this is not possible please tell me. If it is too complicated tell me. I am not using livecycle for this as we had a word document and I just used the find form fields. I am also using Adobe Acrobat 8 Professional.
Thanks
Hello,
Thanks that looks good. I am still missing something but the calc doesn't work when I put in my variables. I will work with it more but nothing happens.
The one thing is I have the default value of the checkbox as 15 so don't know if that messes it up.
Right now I get the default value of $0.00 all the time. When I click on the check box on/off it doesn't do the calcs.
sorry, any more input, what am i missing??
I also changed the syntax error that was posted on your origianl post. You had == 'Off" I changed that to 'Off'
Similar Messages
-
Help with Custom calculation script in Acrobat 8
Hi all, I am using acrobat 8 on OS 10.5
I am trying to add certain fields (numbers) and then subtract another field value to give an end result.
I don't know anything about Javascript, would anyone be able to help with any info on how I achieve this result? I can only see Add, x and average etc... nothing there for subtraction
Thanks for any help in advance
SwenThis should get you started:
>if (event) {
// get values from two text fields
var a = Number(this.getField('Text1').value);
var b = Number(this.getField('Text2').value);
// subtract the values and show it
this.event.target.value = a - b;
Place this in a 3d text field, as a Custom Calculation Script. -
Please help with Javascript obejcts hierarchy
Hi!
Is following Javascript obejcts hierarchy is right?
1. App > 2. Doc > 3. Page >
(from Page) > 3.1 Annotation3D
(from Page) > 3.2 Field (link)
thank u )You have to have Acrobat/Reader open to open a PDF and use some or all of the Acrobat JS features.
When Acrobat/Reader is started various folders are accessed and files within those folders read and processed to create the application. This includes dictionaries, certain global variables, various functions provided by Adobe, and user defined functions or variables. The Adobe provided functions or user provided functions or variables are accessed by their assigned name. So if you created an application folder level function in a file called 'hello.js' containing the following code:
function HelloWorld()
app.alert('Hello World!');
return;
HelloWorld();
Each time you open Acrobat an alert box with "Hello World!" will appear. So even without any PDF open one can perform or have a task done. With application level scripts, you can add menu item, tool bar buttons, or modify menu items, etc. So when you open Acrobat you could have a menu item to create a new blank PDF or add the JS API Reference to the "Help" menu item. And if you selected "Help => JavaScript API', the JS API Reference file would open, whether there is an open PDF or not.
PDF files are opened at the application level, as the application needs to interpret the code of the PDF file and provide the necessary resources for displaying, calculating, linking, etc for the open PDFs. If you open a PDF pragmatically, you need to provide an object name to that PDF. Especially if you are going to reference that file with JavaScript.
Within an open PDF there are various actions. The first is the document level scripts that are used to establish the environment in which that PDF will function. This could include special functions to sum values, compute date differences, perform special key stroke and formatting. There can even be test to see if there are any necessary application level functions available for use the the document.
Within PDF document you can can fields, links, comments, etc. And these items only exist in the PDF document and rely on the PDF document for performing the various task or communicating those task the the application.
By the way with the "HelloWorld" function defined in the application JavaScirpt folder, and PDF opened on that computer can have a button with the 'mouse up' action JavaScript of "HelloWorld();" for the code and any time that button is pressed the alert box that appeared when Acrobat was started will appear. But if you take that PDF to another computer that does not have that file nothing will happen or an error box will appear.
See Getting Started - Developing for PDF by Dave Wright and look around the Planet PDF site.
You also need to realize that Acrobat JavaScript does not run synchronously, so you do not always have the individual scripts running in the same order or speed so it is possible a script will not always start and end before the next script in line is started or ends. And if you have dependencies between these scripts you need to test to see if they are all met. -
Help with query calculations (recursive)
Hi All,
I want some help with a query using a base rate and the result use in the next calculation year.
Here an example:
create table rate_type(
rate_type_id number,
rate_desc nvarchar2(50),
rate_base_year number
insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (1, 'Desc1', 4.6590);
insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (2, 'Desc2', 4.6590);
create table rates (
rate_type_id number
rate_year number,
rate_value number
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2012, 1.2);
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2013, 1.3);
insert into rates(rate_type_id, rate_year, rate_value) values (1, 2014, 1.4);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2012, 1.2);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2013, 1.3);
insert into rates(rate_type_id, rate_year, rate_value) values (2, 2014, 1.4);The calculation for the first year should be the base rate of the rate type. The next year should use the result of the previous year and so on.
The result of my sample data is:
2012 = 4.659 + 1.2 + 4.659 * (1.2 * 0.01) = 5.9149
2013 = 5.9149 + 1.3 + 5.9149 * (1.3 * 0.01) = 7.1859
2014 = 7.1859 + 1.4 + 7.1859 * (1.4 * 0.01) = 8.4721Query result:
NAME 2012 2013 2014
Desc1 5.9149 7.1859 8.4721
Desc2 XXXX XXX XXXX
How can I do this in one select statement? Any ideas?
Thanks!Assuming you are on 11.2:
with t as (
select a.rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
count(*) over(partition by a.rate_type_id) cnt,
row_number() over(partition by a.rate_type_id order by rate_year) rn
from rate_type a,
rates b
where a.rate_type_id = b.rate_type_id
r(
rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
result
) as (
select rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
from t
where rn = 1
union all
select t.rate_type_id,
t.rate_desc,
t.rate_year,
t.rate_base_year,
t.rate_value,
t.cnt,
t.rn,
r.result + t.rate_value + r.result * t.rate_value * 0.01 result
from r,
t
where t.rate_type_id = r.rate_type_id
and t.rn = r.rn + 1
select *
from (
select rate_desc name,
rate_year,
result
from r
where rn <= cnt
pivot (sum(result) for rate_year in (2012,2013,2014))
order by name
NAME 2012 2013 2014
Desc1 5.914908 7.2918018 8.79388703
Desc2 5.914908 7.2918018 8.79388703
SQL> Obviously pivoting assumes you know rate_year values upfront. If not, then without pivoting:
with t as (
select a.rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
count(*) over(partition by a.rate_type_id) cnt,
row_number() over(partition by a.rate_type_id order by rate_year) rn
from rate_type a,
rates b
where a.rate_type_id = b.rate_type_id
r(
rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
result
) as (
select rate_type_id,
rate_desc,
rate_year,
rate_base_year,
rate_value,
cnt,
rn,
rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
from t
where rn = 1
union all
select t.rate_type_id,
t.rate_desc,
t.rate_year,
t.rate_base_year,
t.rate_value,
t.cnt,
t.rn,
r.result + t.rate_value + r.result * t.rate_value * 0.01 result
from r,
t
where t.rate_type_id = r.rate_type_id
and t.rn = r.rn + 1
select rate_desc name,
rate_year,
result
from r
where rn <= cnt
order by name,
rate_year
NAME RATE_YEAR RESULT
Desc1 2012 5.914908
Desc1 2013 7.2918018
Desc1 2014 8.79388703
Desc2 2012 5.914908
Desc2 2013 7.2918018
Desc2 2014 8.79388703
6 rows selected.
SQL> SY. -
URGENT Help With Scientific Calculator!
Hi everybody,
I designed a calculator, and I need help with the rest of the actions. I know I need to use the different Math methods, but I tried tried that and it didn't work. Also, it needs to work as an applet and application, and in the applet, the buttons don't appear in order, how can I fix that?
I will really appreciate your help with this program, I can't get it to work and I'm frustrated, I need to finish this for next Tuesday 16th. Please e-mail me at [email protected].
Below is the code for the calcualtor.
Thanks a lot!
-Maria
// calculator
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class calculator extends JApplet implements
ActionListener
private JButton one, two, three, four, five, six, seven,
eight, nine, zero, dec, eq, plus, minus, mult, div, clear,
mem, mrc, sin, cos, tan, asin, acos, atan, x2, sqrt, exp, pi, percent;
private JLabel output, blank;
private Container container;
private String operation;
private double number1, number2, result;
private boolean clear = false;
//GUI
public void init()
container = getContentPane();
//Title
//super("Calculator");
JPanel container = new JPanel();
container.setLayout( new FlowLayout( FlowLayout.CENTER
output = new JLabel("");
output.setBorder(new MatteBorder(2,2,2,2,Color.gray));
output.setPreferredSize(new Dimension(1,26));
getContentPane().setBackground(Color.white);
getContentPane().add( "North",output );
getContentPane().add( "Center",container );
//blank
blank = new JLabel( " " );
container.add( blank );
//clear
clear = new JButton( "CE" );
clear.addActionListener(this);
container.add( clear );
//seven
seven = new JButton( "7" );
seven.addActionListener(this);
container.add( seven );
//eight
eight = new JButton( "8" );
eight.addActionListener(this);
container.add( eight );
//nine
nine = new JButton( "9" );
nine.addActionListener(this);
container.add( nine );
//div
div = new JButton( "/" );
div.addActionListener(this);
container.add( div );
//four
four = new JButton( "4" );
four.addActionListener(this);
container.add( four );
//five
five = new JButton( "5" );
five.addActionListener(this);
container.add( five );
//six
six = new JButton( "6" );
six.addActionListener(this);
container.add( six );
//mult
mult = new JButton( "*" );
mult.addActionListener(this);
container.add( mult );
//one
one = new JButton( "1" );
one.addActionListener(this);
container.add( one );
//two
two = new JButton( "2" );
two.addActionListener(this);
container.add( two );
//three
three = new JButton( "3" );
three.addActionListener(this);
container.add( three );
//minus
minus = new JButton( "-" );
minus.addActionListener(this);
container.add( minus );
//zero
zero = new JButton( "0" );
zero.addActionListener(this);
container.add( zero );
//dec
dec = new JButton( "." );
dec.addActionListener(this);
container.add( dec );
//plus
plus = new JButton( "+" );
plus.addActionListener(this);
container.add( plus );
//mem
mem = new JButton( "MEM" );
mem.addActionListener(this);
container.add( mem );
//mrc
mrc = new JButton( "MRC" );
mrc.addActionListener(this);
container.add( mrc );
//sin
sin = new JButton( "SIN" );
sin.addActionListener(this);
container.add( sin );
//cos
cos = new JButton( "COS" );
cos.addActionListener(this);
container.add( cos );
//tan
tan = new JButton( "TAN" );
tan.addActionListener(this);
container.add( tan );
//asin
asin = new JButton( "ASIN" );
asin.addActionListener(this);
container.add( asin );
//acos
acos = new JButton( "ACOS" );
cos.addActionListener(this);
container.add( cos );
//atan
atan = new JButton( "ATAN" );
atan.addActionListener(this);
container.add( atan );
//x2
x2 = new JButton( "X2" );
x2.addActionListener(this);
container.add( x2 );
//sqrt
sqrt = new JButton( "SQRT" );
sqrt.addActionListener(this);
container.add( sqrt );
//exp
exp = new JButton( "EXP" );
exp.addActionListener(this);
container.add( exp );
//pi
pi = new JButton( "PI" );
pi.addActionListener(this);
container.add( pi );
//percent
percent = new JButton( "%" );
percent.addActionListener(this);
container.add( percent );
//eq
eq = new JButton( "=" );
eq.addActionListener(this);
container.add( eq );
//Set size and visible
setSize( 190, 285 );
setVisible( true );
public static void main(String args[]){
//execute applet as application
//applet's window
JFrame applicationWindow = new JFrame("calculator");
applicationWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//applet instance
calculator appletObject = new calculator();
//init and start methods
appletObject.init();
appletObject.start();
} // end main
public void actionPerformed(ActionEvent ae)
JButton but = ( JButton )ae.getSource();
//dec action
if( but.getText() == "." )
//if dec is pressed, first check to make shure there
is not already a decimal
String temp = output.getText();
if( temp.indexOf( '.' ) == -1 )
output.setText( output.getText() + but.getText() );
//clear action
else if( but.getText() == "CE" )
output.setText( "" );
operation = "";
number1 = 0.0;
number2 = 0.0;
//plus action
else if( but.getText() == "+" )
operation = "+";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//minus action
else if( but.getText() == "-" )
operation = "-";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//mult action
else if( but.getText() == "*" )
operation = "*";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//div action
else if( but.getText() == "/" )
operation = "/";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//eq action
else if( but.getText() == "=" )
number2 = Double.parseDouble( output.getText() );
if( operation == "+" )
result = number1 + number2;
else if( operation == "-" )
result = number1 - number2;
else if( operation == "*" )
result = number1 * number2;
else if( operation == "/" )
result = number1 / number2;
//output result
output.setText( String.valueOf( result ) );
clear = true;
operation = "";
//default action
else
if( clear == true )
output.setText( "" );
clear = false;
output.setText( output.getText() + but.getText() );
}Multiple post:
http://forum.java.sun.com/thread.jsp?forum=31&thread=474370&tstart=0&trange=30 -
Need Help with Javascript for Acrobat Pro 9
Hello,
I am creating a PDF form in Adobe Acrobat Profession 9. Not having a lot of experience with Javascript, I have found this forum very helpful and have used many of the script examples for other issues I have had. I was hoping someone could help with the following script, I have tried many variations, cannot get it to work.
var ratio = this.getField("ratio").value
var concentration = this.getField("concentration").value
var result = this.getField("result").value
if(ratio.value>=50.00)
{result.value ='PASS';}
if(ratio.value".value>=40.00)
{result.value ='PASS';}
if((concentration.value ==61) && (ratio.value >= 49.25))
{result.value ='PASS';}
if((concentration.value ==61) && (ratio.value >= 39.25))
{result.value ='PASS';}
if((concentration.value ==62) && (ratio.value >= 48.50))
{result.value ='PASS';}
if((concentration.value ==62) && (ratio.value >= 38.50))
{result.value ='PASS';}
else
{result.value = 'FAIL';}
This is just a piece of the code The concentration values run from 61 through 99 and the ratio value varies for each concentration value, there is a high ratio and a low ratio. The result of this field with populate the results field with a PASS or FAIL. This is not working......any help is greatly appreciated!Thanks George. I updated the script to:
// Get a reference to the result field
var ratio = this.getField("ratio");
// Get a reference to the result field
var concentration = this.getField("concentration");
// Get a reference to the result field
var result = this.getField("result");
if(ratio.value>=50.00)
{result.value ='PASS';}
if(ratio.value >=40.00)
{result.value ='PASS';}
if((concentration.value ==61) && (ratio.value >= 49.25))
{result.value ='PASS';}
if((concentration.value ==61) && (ratio.value >= 39.25))
{result.value ='PASS';}
if((concentration.value ==62) && (ratio.value >= 48.50))
{result.value ='PASS';}
if((concentration.value ==62) && (ratio.value >= 38.50))
{result.value ='PASS';}
else
{result.value = 'FAIL';}
However, I am still getting a FAIL result even when the ratio is 50.00 or equal to the passable ratio. -
Please Please help with JavaScript and Actions
Hello!
Is there a way to perform a saved Action from the Action Pallette using a JavaScript script? I know there is a way to do it with Visual Basic.
Is there a way to run a Visual Basic script from a JavaScript script?(which could be a potential workaround if JavaScript CANNOT call on an Action)
Is there a way to call on a JavaScript from an Action?
Here's specific information on my problem:
I am using Illustrator CS2 on a PC
I have written all of the JavaScript scripts that I need to perform various layer selection procedures and they all work perfectly. I have placed them in the Presets > Scripts folder so that they appear in my file menu.
I wrote a very long action that called on these scripts (using Insert Menu Item > then selecting the script by going File > Scripts) sequentially and did some selecting and copy-pasting and applying graphic styles in between scripts. The Action worked PERFECTLY and ran all the scripts I needed to an automated a process that usually takes me an hour in less than five minutes!
I saved the actions and saved the file.
After closing Illustrator all of the lines of the action that called on scripts disappeared! It seems this is a known bug...I currently know of no workaround.
Can anyone help with any of the following things:
1. Getting actions to SAVE the commands to run javascripts
2. Writing a JavaScript that runs an Illustrator Action
3. Writing a JavaScript that runs a Visual Basic script that runs an Illustrator Action.
I spent three days learning the basics of JavaScript (mostly by trial and error) and successfully wrote all the scripts I needed...I was overjoyed! But now that I've closed illustrator my actions to run said scripts do not work. PLEASE ADVISE!!!
Thanks in advance,
Matthewtry next
1)if possible split JS-code into 2 parts (before/after action)
2)make vbs script with contents
Set appRef = CreateObject("Illustrator.Application.3")
appRef.DoJavaScriptFile("C:\my1.js")
appRef.DoScript(Action As String, From As String)
'add wait while ActionIsRunning
appRef.DoJavaScriptFile("C:\my2.js")
3) run vbs (File > Scripts or double-click). -
I have an existing pdf that i am trying to edit and make it more functional...i.e. fillable info with auto calculations of cost based on a given number (times a specific cost)
Example on the form....
Car Registrations (per car) _____ X $25 _________
The first line above is # Cars Registered
The last line is Total Cost
The blank lines above i have added a text box to for auto calculations. I have formated these boxes as numbers (first line) and dollar value total (second line)
I've added another text box for the $25 and placed it overtop the worded one. I've locked this box and the total box. I've calculated the product of the total box by linking it to the first line and the $25 to give the total cost...
Problem is, it isnt working....the total box isn't seeing the $25 to give a proper calc. Whatever number i place in the first line, only zero shows in the total.
I'm obviously missing something....been at this for two days....frustrated. I have many more inputs like this on the form, and eventually want all the totals to provide sub totals and a grand total. I understand how this all works to a degree, doesnt seem that difficult, but i have to be missing something.
I even tried re-creating the document in word, input to adobe, make a new form, let the system recoginize areas as fillable, etc, etc, etc. When i get to the calculations portion, same result...there are not many tutorials out there on this...sadly
Woking on a MAC...
I have acrobat X Progr8snkbite wrote:
I have an existing pdf that i am trying to edit and make it more functional...i.e. fillable info with auto calculations of cost based on a given number (times a specific cost)
Example on the form....
Car Registrations (per car) _____ X $25 _________
The first line above is # Cars Registered
The last line is Total Cost
The blank lines above i have added a text box to for auto calculations. I have formated these boxes as numbers (first line) and dollar value total (second line)
I've added another text box for the $25 and placed it overtop the worded one. I've locked this box and the total box. I've calculated the product of the total box by linking it to the first line and the $25 to give the total cost...
Problem is, it isnt working....the total box isn't seeing the $25 to give a proper calc. Whatever number i place in the first line, only zero shows in the total.
I'm obviously missing something....been at this for two days....frustrated. I have many more inputs like this on the form, and eventually want all the totals to provide sub totals and a grand total. I understand how this all works to a degree, doesnt seem that difficult, but i have to be missing something.
I even tried re-creating the document in word, input to adobe, make a new form, let the system recoginize areas as fillable, etc, etc, etc. When i get to the calculations portion, same result...there are not many tutorials out there on this...sadly
Woking on a MAC...
I have acrobat X Pro
I created your sample.
name the field after Number of cars, as car
The calulation field named total -
PLEASE help with JavaScript parsing of WSDL return
Can someone help with parsing return WSDL data?
My return WSDL data is a concatenated string of alias names (firstname middlename lastname generation) delininated with an "@":
7433|ALIAS|John|W|Smith| @7432|ALIAS|Johnny| |Smith| @7430|ALIAS|JJ| |Smithers| @7431|ALIAS|JJ| |Smith| @7400|ALIAS|Jon| |Smith| @7416|ALIAS|John|Wilber|Smith|JR
I must have these names appear on my forms in a "lastname, firstname middlename generation" format. Can anyone provide expertise in this area if I provide the table.column reference?
alias.alternate_id = tmp[0];
alias.type = tmp[1];
alias.firstname = tmp[2];
alias.middlename = tmp[3];
alias.lastname = tmp[4];
alias.generation = tmp[5];Can someone help with parsing return WSDL data?
My return WSDL data is a concatenated string of alias names (firstname middlename lastname generation) delininated with an "@":
7433|ALIAS|John|W|Smith| @7432|ALIAS|Johnny| |Smith| @7430|ALIAS|JJ| |Smithers| @7431|ALIAS|JJ| |Smith| @7400|ALIAS|Jon| |Smith| @7416|ALIAS|John|Wilber|Smith|JR
I must have these names appear on my forms in a "lastname, firstname middlename generation" format. Can anyone provide expertise in this area if I provide the table.column reference?
alias.alternate_id = tmp[0];
alias.type = tmp[1];
alias.firstname = tmp[2];
alias.middlename = tmp[3];
alias.lastname = tmp[4];
alias.generation = tmp[5]; -
Need help with a calculated column - is there any way to reference a value in the current row?
Hey guys,
I'm a bit of a DAX newbie, and I'm running into a block. I'm creating a Power View report about IT tickets. We are going to be creating a cube to automate the data soon, I'm currently working with a flat Excel Data Table of data to demonstrate the Power
View reporting capabilities to the team. I need the default display to show the top 4-5 items basked on the Ticket Count. The three applicable columns I'm using are the TicketID, the ContactReason, and the AssetCategory - all three are
text. One slide will show the top five Contact Reasons by Ticket Count, and the other will show the top five Categories by Ticket Count. The users will see this default view, but will be able to change it to see differently ranked items or can clear the
ranking slicer altogether.
What I've accomplished so far is to create the Calculated Field [Ticket Count] = COUNTA(Table1[TicketID])
And 2 other calculated fields:
[Contact Rank] = RANKX(ALL(Table1[ContactReason]),[Ticket Count],,,DENSE)
[Asset Rank] = RANKX(ALL(Table1[AssetCategory]),[Ticket Count],,,DENSE)
If I were creating a Pivot Table, this would be great. These fields calculate everything the right way. The problem is, I need to have a Rank slicer on each slide and the calculation by itself contains no data - with no data, there's nothing to slice. I
realized I need to actually have columns of data so I can create a slicer. I need each row of the table to show the same [Contact Rank] for every instance of a particular ContactReason (and the same for the [Asset Rank] and AssetCategory).
The RANKX formulas pasted into the Calculated Column section only show a value of 1 - with no Pivot table summarizing the fields, it's counting each row's ticket once, giving every line the tied Rank of #1.
I've solved the problem in Excel by creating 2 Pivot Tables on a separate sheet that have the data field and the calculated field for ContactRason and AssetCategory. Then on my Excel Data Table, I've added two columns that do a VLOOKUP and pull over a the
Calculated Rank from each Pivot Table that match the ContactReason and AssetCategory fields. This works on the flat Excel Data Table now, but will not be a solutions when we start pulling the data from the cube (and there is no flat table).
What I think I need is an Expression for the RANKX formula that can give me, for each row, the count of all of the times a ContactReason shows up in an entire column. There's only about 100,000 lines of data and each ContactReason or AssetCategory
may show up several thousand times. But if I can get the expression to return that count, then the RANKX formula should work in the Column. If it wasn't a DAX formula, I'd use a COUNTIF and say 'Count the entire ContactReason column anytime it's equal to the
ContactReason on THIS row', but in DAX I don't know how to reference a single value in a row. I've tried the CALCULATE() formula, but it seems like the filter needs a specific value, and doesn't work on a dynamic "cell" value.
Any help would be greatly appreciated! (I hope it all makes sense!)If I've understood you correctly then the ALLEXCEPT function may be what you're after and it could be applied in a similar way to the following...
=
RANKX(
ALL(Table1),
CALCULATE(
COUNTROWS(table1),
ALLEXCEPT(Table1, Table1[ContactReason])
DENSE
If this has missed the mark, would it be possible to clarify the requirement further?
Regards,
Michael Amadi
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
Website: http://www.nimblelearn.com
Blog: http://www.nimblelearn.com/blog
Twitter: @nimblelearn -
Hi, all, I am working on a form that was previously made in Excel. I wanted to remake this in an expandable pdf fillable so that I can add the accessibiltiy information to the form. The first link is to the static pdf converted from Excel here:
https://acrobat.com/#d=lIGyn*lpuWSQ-Qzkklml6w
The second link is the the form as my strained brain has recreated it. I'm sure there is probably a better method than I have chosen and I am open to all suggestions. But I can't get the table to total.
In the first table, all the calcs work correctly, ie 11, 12, 13, 14 and the total from 14 does show up in 15. but I need 17 to show the amount after the Discount (#16) is deducted. You would think something simple would do the trick, like SubTotal - Discount. That doesn't work.
Column 19 should total in the footer row next to 21. It doesn't. And column 23 should total into space #24. I have been trying for hours at a time to come up with the magic script to make this form work but......now I've decided to grovel for help.
https://acrobat.com/#d=mzovRUkKit7JnPVebPKgZwHi,
Here is your form back to you: https://acrobat.com/#d=a06D-SL7SK58ZulXCKNSuw. Please note that all of the scripts are FormCalc, as we are using the sum function and the wildcard. Neither of these will work in JavaScript.
Have a look at this post on how to reference objects, in particular the deomonstration of Control+Click:
http://www.assuredynamics.com/index.php/2011/05/som-expressions/
Also with buttons with linear gradient I would change the click behaviour from Inverted to Outline or None. It will be a little easier on the eyes. I have changed the two Add buttons. Also I think that you are getting in to readibility issues with the contrast between the button background and the black caption. I would recommend a read of this post, which outlines an approach to primary buttons (like the add rows) and secondary buttons (like the delete rows):
http://www.assuredynamics.com/index.php/2010/12/buttons/.
Maybe this discussion on colours:
http://www.assuredynamics.com/index.php/2011/02/any-colour-as-long-as-its-black/
Hope that helps,
Niall -
I have a simple form on a web page for associaiton members to
order lapel pins. I want to provide a toal cost of the order but I
can't for the life of me get anything to multiply the value in a
text fiels by a constant number ($5.00). I found some Javascript on
the internet but I couldn't get it to function either. I am using
Dreamweaver 8 and cannot find any reference to simple math
calculations. Imust be overlooking something as something so simple
can't be that hard. Can someone provide me with some simple script
or method of doing this?>I have a simple form on a web page for associaiton
members to order lapel
>pins.
> I want to provide a toal cost of the order but I can't
for the life of me
> get
> anything to multiply the value in a text fiels by a
constant number
> ($5.00).
In ASP/VBSCRIPT:
<%
Dim varAmount
varAmount = Request.Form("HowMany") * 5
Response.Write FormatCurrency("varAmount")
%> -
I posted a little bit ago, but solved part of the problem I'm having with this javascript. I'm new to javascript and am trying my best to understand how to do it. I have a lightbox script that I'm trying to edit so that I can have a different image be the starting point of the images in the lightbox, depending on which is clicked. Currently, no matter how I change the script, I have the same starting image. I think that I don't understand the handlers completely that affect the total script. Any help understanding these would be helpful.
Here's the affected html:
<div id="content_1" class="content">
<img src="file1bottom.png" width="982" height="674" alt="Photos of Holston Room" usemap="#filmstripmap1">
<map name="filmstripmap1" >
<area id="1" shape="poly" coords="732,91,884,97,877,198,718,187" class="open_lightbox" href="#" alt="Photo_1">
<area id="2" shape="poly" coords="724,205,874,214,868,312,717,301" class="open_lightbox" href="#" alt="Photo_2">
<area id="3" shape="poly" coords="717,324,872,332,862,432,713,420" class="open_lightbox" href="#" alt="Photo_3">
<area id="4" shape="poly" coords="711,440,865,447,857,547,709,537" class="open_lightbox" href="#" alt="Photo_4">
<area id="5" shape="poly" coords="470,150,617,130,628,231,483,245" class="open_lightbox" href="#" alt="Photo_5">
<area id="6" shape="poly" coords="481,260,630,247,641,347,491,361" class="open_lightbox" href="#" alt="Photo_6">
<area id="7" shape="poly" coords="492,380,644,363,654,460,504,477" class="open_lightbox" href="#" alt="Photo_7">
</map>
<div class="lightbox-panel">
<img id="photo1" src="HolstonImages/00.jpg" class="ntt_media_file" alt="Room Photo 1"/>
<img id="photo2" src="HolstonImages/01.jpg" style="display:none;" class="ntt_media_file" alt="Room Photo 2"/>
<img id="photo3" src="HolstonImages/02.jpg" style="display:none;" class="ntt_media_file" alt="Room Photo 3"/>
<img id="photo4" src="HolstonImages/03.jpg" style="display:none;" class="ntt_media_file" alt="Room Photo 4"/>
<img id="photo5" src="HolstonImages/04.jpg" style="display:none;" class="ntt_media_file" alt="Room Photo 5"/>
<img id="photo6" src="HolstonImages/05.jpg" style="display:none;" class="ntt_media_file" alt="Room Photo 6"/>
<img id="photo7" src="HolstonImages/06.jpg" style="display:none;" class="ntt_media_file" alt="Room Photo 7"/>
<iframe width="750" height="500" style="display:none;"
class="ntt_media_file" frameborder="0" allowfullscreen></iframe>
<div class="ntt_prev_button">
<img src="fc_left_arrow.png" id="ntt_prev_media" alt="Get Previous Media Item"/>
</div>
<div class="ntt_next_button">
<img src="fc_right_arrow.png" id="ntt_next_media" alt="Get Next Media Item"/>
</div>
<div class="ntt_close_button">
<img src="ntt_close_button.png" id="close-panel" alt="Close Lightbox"/>
</div>
</div>
<div id="lightbox_background"></div>
</div>
Here is the javascript (highlighted where I'm trying to add script to change it to pull up which image I want:
$(document).ready(function(){
// When a link of class open_lightbox is clicked this function is triggered
$("#1.open_lightbox").click(function(){
// Sets the opacity for the background shadow to 85%
$("#lightbox_background").css({opacity: 0.75});
// Makes all of the hidden parts of the lightbox appear
$("#lightbox_background, .lightbox-panel, .ntt_close_button, .ntt_next_button, .ntt_prev_button").fadeIn(300);
// Gets the height and width of the first media type displayed
// Media type is a reference to any images or movies
ntt_img_height = $('.ntt_media_file:first').css('height');
ntt_img_width = $('.ntt_media_file:first').css('width');
// Changes the size of the parent div that surrounds the media on screen
// Animate will make the changes slowly for dramtic effect
$('.ntt_media_file:first').parent().animate({
height: ntt_img_height+100,
width: ntt_img_width
}, "slow");
$("#2.open_lightbox").click(function(){
$("#lightbox_background").css({opacity: 0.75});
$("#lightbox_background, .lightbox-panel .ntt_close_button, .ntt_next_button, .ntt_prev_button").fadeIn(300);
$(".ntt_media_file").is("#photo2")
// If an img is clicked on with the id of close-panel run this function
$("img#close-panel").click(function(){
// Make all the lightbox elements disappear
$("#lightbox_background, .lightbox-panel, .ntt_close_button, .ntt_next_button, .ntt_prev_button").fadeOut(300);
// When the next button is clicked it triggers a click event on
// the current image visible on the screen
$("img#ntt_next_media").click(function(){
$(".ntt_media_file:visible").trigger('click');
// Closes the lightbox if the escape key is pressed
$(document).keypress(function(e) {
// If the key pressed was escape close the lightbox
if(e.keyCode == 27)
$("#lightbox_background, .lightbox-panel").fadeOut(300);
// This event is triggered any time the user clicks on anything with a
// class of ntt_media_file.
// It cycles through the different media types from first to last
$(".ntt_media_file").click(function(){
if( $(this).next('.ntt_media_file').length == 0)
// Make all visible media disappear in the lightbox
$(".ntt_media_file:visible").toggle();
// Display the first media in the lightbox
$(".ntt_media_file:first").toggle();
// Call this to resize the div that surrounds the media
// based on the size of the media displayed
ntt_resize_div_container();
} else {
// Make all visible media disappear in the lightbox
$(".ntt_media_file:visible").toggle();
// this is a reference to the element that was clicked to trigger
// this function. This statement is causing the next media
// with the class ntt_media_file to appear
$(this).next('.ntt_media_file').toggle();
// Call this to resize the div that surrounds the media
// based on the size of the media displayed
ntt_resize_div_container();
// This event is triggered any time the user clicks on the previous
// button.
// It cycles backwards through the different media types
$(".ntt_prev_button").click(function(){
// This checks to see if a media file is available to display
if( $(".ntt_media_file:visible").prev('.ntt_media_file').length == 0)
// Make all visible media disappear in the lightbox
$(".ntt_media_file:visible").toggle();
// Display the first media in the lightbox
$(".ntt_media_file:last").toggle();
// Call this to resize the div that surrounds the media
// based on the size of the media displayed
ntt_resize_div_container();
} else {
// Get the current index value for the media shown
var ntt_current_media_shown = $(".ntt_media_file:visible").index();
// Get the index for the media that proceeds the current image
var ntt_prev_item_to_show = ntt_current_media_shown - 1;
// Toggle off all visible media in the lightbox
$(".ntt_media_file:visible").toggle();
// Toggle on the media previous to the last shown
$(".ntt_media_file").eq(ntt_prev_item_to_show).toggle();
// Call this function to resize the div based on dimensions
// of the media shown in the lightbox
ntt_resize_div_container();
// Call this function to resize the div based on dimensions
// of the media shown in the lightbox
function ntt_resize_div_container()
// Get the current height and width of the visible media in lightbox
ntt_img_height = $(".ntt_media_file:visible").css('height');
ntt_img_width = $(".ntt_media_file:visible").css('width');
// Define the margins based on the size of the image
ntt_img_margin_top = (ntt_img_height / 4);
ntt_img_margin_left = (ntt_img_width / 4);
// Target the div that surrounds the visible media (it's a div)
// Adjust the size of the parent div based on the dimensions
// of the media it contains
$(".ntt_media_file:visible").parent().animate({
height: ntt_img_height+100,
width: ntt_img_width
}, "fast");
$(".ntt_media_file:visible").parent().css({
'position': 'fixed',
'top': '22%',
'left': '22%',
'min-width': '775px',
'margin-top': ntt_img_margin_top,
'margin-left': ntt_img_margin_left
Here is the link the the uploaded script and html: www.theriveroverlook.com/Trial.htmlHi,
May be this can help:
<html>
<body>
<script language="javascript">
var num1=0;
var num2=0;
var num3=0;
function printGrade(){
var score=prompt("Enter your score","Enter your score");
if(score>81)
alert("Grade : A");
else if(score>61)
alert("Grade : B");
else if(score>41)
alert("Grade : C");
else
alert("Grade : D");
function input3Number(){
num1=prompt("Enter First Number","Enter First Number");
num2=prompt("Enter Second Number","Enter Second Number");
num3=prompt("Enter Third Number","Enter Third Number");
function returnMax(){
input3Number();
if(num1>num2){
if(num1>num3)
alert(num1);
else
alert(num3);
}else{
if(num2>num3)
alert(num2);
else
alert(num3);
function returnMin(){
input3Number();
if(num1<num2){
if(num1<num3)
alert(num1);
else
alert(num3);
}else{
if(num2<num3)
alert(num2);
else
alert(num3);
function daysInMonth(){
var monthNumber=prompt("Enter Month in Number","");
if(monthNumber==1 || monthNumber==3 || monthNumber==5 || monthNumber==7 || monthNumber==8 || monthNumber==10 || monthNumber==12)
alert("Days in Month is : 31");
else if(monthNumber==2)
alert("Days in Month is : 28/29 (Leap year)");
else
alert("Days in Month is : 30");
</script>
<input type="button" name="month1" value="Days in a Month" onclick="daysInMonth()">
<input type="button" name="B1" value="Calculate Grade" onclick="printGrade()">
<input type="button" name="max" value="Maximum number" onclick="returnMax()">
<input type="button" name="max" value="Minimum number" onclick="returnMin()">
</body>
</html> -
Need help with JavaScript "Galleria" gallery coding
I am trying to create a clickable gallery with the filmstrip either on the top or on left hand side for people to click to see my portfolio. I want the first photo to be auto loaded. I downloaded the javascript from;
http://galleria.aino.se/
I have the coding for;
galleria.js
galleria.classic.js
jquery.min.js
I try the basic tutorial given on the website http://galleria.aino.se/
but it seem more coding are needed.
I want the similar gallery as shown on the above website without the black void space on the side of the large photo. I do not want the Rewind and Fastforward buttons as shown on the side of the large photo (not on the thumbnail)
I have tried downloading few similer files and trying to use their html coding but there werent the full tutorial.
The coding below only shows two small photos left top of the page without the large photo either on top of them.
I dont understand much about coding. Only been doing this for like few months and still learning but i am stuck now. Much apperciated if you can help me out here with what code need to go where. Many thanks.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="test/jquery.min.js"></script>
<script src="test/galleria.js"></script>
<script>Galleria.loadTheme('test/galleria.classic.js');</script>
<script>$('.gallery').galleria();</script>
</head>
<body>
<div class="gallery">
<a href="_images/home/Bridge.png"><img src="_images/home/Bridge.png" width="100"></a>
<a href="_images/home/Haz_Restaurant.JPG"><img src="_images/home/Haz_Restaurant.JPG" width="100"></a>
</div>
</body>
</html>Using the same files, i have found a different code where they place the tumbnails at the bottom of the slideshow rather than on the side. Here is the code;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Galleria Demo 1</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="imagetoolbar" content="false">
<meta name="description" content="">
<meta name="keywords" content="">
<link href="test/galleria.css" rel="stylesheet" type="text/css" media="screen">
<script type="text/javascript" src="test/jquery.min.js"></script>
<script type="text/javascript" src="test/jquery.galleria.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability
$('ul.gallery_demo').galleria({
history : true, // activates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable
insert : '#main_image', // the containing selector for our main image
onImage : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
// fade in the image & caption
image.css('display','none').fadeIn(1000);
caption.css('display','none').fadeIn(1000);
// fetch the thumbnail container
var _li = thumb.parents('li');
// fade out inactive thumbnail
_li.siblings().children('img.selected').fadeTo(500,0.3);
// fade in active thumbnail
thumb.fadeTo('fast',1).addClass('selected');
// add a title for the clickable image
image.attr('title','Next image >>');
onThumb : function(thumb) { // thumbnail effects goes here
// fetch the thumbnail container
var _li = thumb.parents('li');
// if thumbnail is active, fade all the way.
var _fadeTo = _li.is('.active') ? '1' : '0.3';
// fade in the thumbnail when finnished loading
thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
// hover effects
thumb.hover(
function() { thumb.fadeTo('fast',1); },
function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
</script>
<style media="screen,projection" type="text/css">
/* BEGIN DEMO STYLE */
*{margin:0;padding:0}
body{padding:20px;background:white;text-align:center;background:black;color:#bba;font:80% /140% georgia,serif;}
h1,h2{font:bold 80% 'helvetica neue',sans-serif;letter-spacing:3px;text-transform:uppercase;}
a{color:#348;text-decoration:none;outline:none;}
a:hover{color:#67a;}
.caption{font-style:italic;color:#887;}
.demo{position:relative;margin-top:2em;}
.gallery_demo{width:702px;margin:0 auto;}
.gallery_demo li{width:68px;height:50px;border:3px double #111;margin: 0 2px;background:#000;}
.gallery_demo li div{left:240px}
.gallery_demo li div .caption{font:italic 0.7em/1.4 georgia,serif;}
#main_image{margin:0 auto 60px auto;height:438px;width:700px;background:black;}
#main_image img{margin-bottom:10px;}
.nav{padding-top:15px;clear:both;font:80% 'helvetica neue',sans-serif;letter-spacing:3px;text-transform:uppercase;}
.info{text-align:left;width:700px;margin:30px auto;border-top:1px dotted #221;padding-top:30px;}
.info p{margin-top:1.6em;}
</style>
</head>
<body>
<h1>Galleria Demo 01</h1>
<div class="demo">
<div id="main_image"></div>
<ul class="gallery_demo_unstyled">
<li><img src="test/img/flowing-rock.jpg" alt="Flowing Rock" title="Flowing Rock Caption"></li>
<li><img src="test/img/stones.jpg" alt="Stones" title="Stones - from Apple images"></li>
<li class="active"><img src="test/img/grass-blades.jpg" alt="Grass Blades" title="Apple nature desktop images"></li>
<li><img src="test/img/ladybug.jpg" alt="Ladybug" title="Ut rutrum, lectus eu pulvinar elementum, lacus urna vestibulum ipsum"></li>
<li><img src="test/img/lightning.jpg" alt="Lightning" title="Black & White"></li>
<li><img src="test/img/lotus.jpg" alt="Lotus" title="Fusce quam mi, sagittis nec, adipiscing at, sodales quis"></li>
<li><img src="test/img/mojave.jpg" alt="Mojave" title="Suspendisse volutpat posuere dui. Suspendisse sit amet lorem et risus faucibus pellentesque."></li>
<li><img src="test/img/pier.jpg" alt="Pier" title="Proin erat nisi"></li>
<li><img src="test/img/sea-mist.jpg" alt="Sea Mist" title="Caption text from title"></li>
</ul>
<p class="nav"><a href="#" onclick="$.galleria.prev(); return false;">« previous</a> | <a href="#" onclick="$.galleria.next(); return false;">next »</a></p>
</div> -
Need help with javascript drop down menu
Hi,
I inherited a website that was already created. I do not know
what version of dreamweaver they created it in but I have
Dreamweaver MX 2004. I am trying to make changes to the drop down
menus. I have figured most everything else out about dreamweaver
but cant figure out how these menu's are made or can be modified. I
have gone into the main template and clicked on the menu section I
want to modify. All it shows it a link to javascript:; I have
searched everywhere for what this means or how to modify it but
can't find anything. Can someone tell me how to get to this info so
I can make changes. Thanks. My website is www.pfcal.org if that
helps.Oh boy. Templates are not for uploading. They have no effect
on the
server. They only change local files which must then be
uploaded to the
server. But - I'm troubled by this comment -
> It didnt give me an option to "save" though
When you made the changes did the template page get marked as
"dirty" (with
an asterisk beside the name)? Which DW are you using?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"sjg23" <[email protected]> wrote in message
news:[email protected]...
> Ok. thanks. I did that but nothing changed. Here is what
I have now:
>
> <div id="MMMenuContainer1112210633_0">
> <div id="MMMenu1112210633_0"
onmouseout="MM_menuStartTimeout(100);"
> onmouseover="MM_menuResetTimeout();">
> <a href="../message_director.cfm"
id="MMMenu1112210633_0_Item_0"
> class="MMMIFVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
> Director's Message
> </a>
> <a href="../mission.cfm"
id="MMMenu1112210633_0_Item_1"
> class="MMMIVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
> Our Mission
> </a>
> <a href="../history.cfm"
id="MMMenu1112210633_0_Item_2"
> class="MMMIVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
> Our History
> </a>
> <a href="../leadership_transiton.cfm"
id="MMMenu1112210633_0_Item_3"
> class="MMMIVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
> Leadership Transition
> </a>
> <a href="../pcl_organized.cfm"
id="MMMenu1112210633_0_Item_4"
> class="MMMIVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
> How PCL is Organized
> </a>
> <a href="../board_directors.cfm"
id="MMMenu1112210633_0_Item_5"
> class="MMMIVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
>
Board of Directors and Officers
> </a>
> <a href="VideoNGO.cfm" id="MMMenu1112210633_0_Item_6"
> class="MMMIVStyleMMMenu1112210633_0"
>
onmouseover="MM_menuOverMenuItem('MMMenu1112210633_0');">
> See our promotional video</a>
>
> </div>
> </div>
>
> I made this change in the html code of the page
"main.dwt" which is my
> main
> template. It didnt give me an option to "save" though so
it's like it
> doesnt
> recognize that I changed anything. I saved it anyway and
uploaded but no
> change
> on the web.
>
Maybe you are looking for
-
Have a Guest option at start up
This morning I have a guest person option at start up. I didn't do anything to the system. Where did that come from?
-
Why, because some clumsy, careless humans couldn't stop scratching a less that 1/4 inch wide lens? That is no reason for replacing the lens and pandering to their inability to handle advanced technology is not going to push the technology forward. T
-
How do i get my computer to recognize my iphone and download itunes?
When i plug my iphone up to my laptop it recognizes it but never pulls up itunes and when i take it to the other computer that has itunes already on it that itunes does not recognize it. what do i do?
-
Hi All, I am running into the issue Sun jdk bug of "http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6400872" and it looks like, its fixed in 1.6 jdk... Can i upgrade the 10.1.3.1 SOA suite to 1.6 jdk??? how do i do it??? Also, my SOA uses java ver
-
My wireless mighty mouse started acting erratic again today. The Bluetooth 2.0 update from a few weeks back seemed to fix this problem for a good 10 days or so but unfortunately, the erratic mouse problem is back. So I ran some tests on my hard drive