Display tcl command result in single column?
I think I've used/seen the method to display the results of a given tcl command with \n newline placed between each item so the result set appears as a nice column list instead of the space deliminated list. How does one do this again?
I want to run any command like "git_pins" and then instead of the space deliminated continual block output, have each item result on an individual line.
THANKS!
example:
puts [join [get_pins] \n]
found on http://forums.xilinx.com/t5/Vivado-TCL-Community/How-to-use-tcl-to-generate-a-project-file-with-verilog-source/m-p/515043/highlight/true#M2131
Similar Messages
-
How to display MySql query results in multiple columns?
Hi, I know how to display PHP/MySq
l query results in a single column, but I am really stuck at displa
ying the results in multiple columns in DW CS4.
Can anyone help me with a code example?. I am new to php/mysql. ThanksAre you asking how to pivot the results of the query? Do a search for horizontal looping. If that's not what you are asking, please provide more details.
-
Displaying the values from a single column into two columns???
hi buddies.....I've a table "Stock" and its fields are:
Date, Invoice#, prod_id, sal_qty, pur_qty, rate, status
The "rate" column stores the rate value on which a product was sold or purchased and "status" column values are like "S" for Sale,"OP" for opening and "P" for purchase.
The problem here to me is that I'm unable to pick the purchase & sale rate of a product based on the status either "S" or "P". Is it possible to pick the purchase rate of a product sold between a specified limit of dates??? and show both sale & purchase rates in two separate columns in the result sets for a given product in a specified duration. The resulte set format should be like this:
Prod_id Sale_Rate Pur_RateDear Dmitri,
Let me tell u my case more elaborately so that u can have a better insight on my problem. I've a Stock table to which I'm trying to use to calculate current stock quantity, its value and profit per sale transaction. It has following simple description.
Stock_Table:
Invoice# Date Product Batch# Sale_QTY Pur_QTY Rate Status
Pur-001 01/01/05 Asprin AB123 0 100 10 OP --(Opening)
Pur-002 02/01/05 Paracetamol CD456 0 150 15 OP
Pur-002 03/01/05 Menthol XY333 0 80 7 OP
Pur-003 01/01/05 Asprin ZZ990 0 50 8 P ..(Purchase)
Sale001 02/01/05 Asprin AB123 10 0 2 S
Sale001 02/01/05 Paracetamol CD456 5 0 16 S ..(Sale)
Sale002 04/01/05 Asprin ZZ990 6 0 10 S
Sale002 04/01/05 Paracetamol CD456 7 0 20 S
Sale002 04/01/05 Menthol XY333 4 0 10 S
From this design can u calulate the difference of sale & purchase rate of a product during a range of dates(which is the Profit)? i.e firstly pick a sale transaction and then minus the purchase rate of the product from the sale rate in that sale transaction by looking at the product name and its batch number.
While solving this case, please keep in mind that I'm using Oracle 8.0 which doesn't support inlined Sub-Query(a query within FROM clause). So giving u a hint(although I'm not genious enough;), I tried the Self Join at Stock Table by picking the sale rows at first and then purchase rows afterwords by giving this table two different names. I also tried the following query by joining the Sale Table with Stock Table. Is it the right way I'm heading towards???
SELECT S.Sale_Date, SD.Invoice#, SD.Product, SD.QTY, SD.Rate Sale_Rate,
ST.Rate Pur_Rate, ST.Product
FROM Invoice_Master S, Invoice_Detail SD, Stock ST
WHERE S.Invoice# = SD.Invoice#
AND ST.Status IN('OP','P')
AND ST.Product = SD.Product
AND S.Sale_Date BETWEEN :From_Date AND :To_Date
AND SD.Product = P.Product
ORDER BY S.Sale_Date -
How to display two or more links in a single column
Hi,
Is there a way to display two links in a single column in a sql query report . I am able to specify one but I am not able to add links to the same column . I want to take the same column id and redirect the user to different pages based on the values selected .
ThanksThere is no way to this declaratively that I know of. Some alternatives...
1. Put the conditional branching logic in the report SQL itself. e.g. case when ... then '< a href=..' else '< a href=...' end and make sure the column display type is Standard Report column
2. Have the declarative column link go to a dummy/intermediate page and setup On Load: Before-Header branches on that page to redirect to the desired page based on the item value(s) passed in to the intermediate page. -
Display of Search Results - Repositioning the "See Also" Command
Hello guys
Does any of you know if it is possible to move the "See Also"-command? Normally the command would be displayed here under "Commands" next to the heading:
Icon - Heading - Commands
Relevancy - Descr.
Rating - Properties (like modifiedby, contentlength etc.)
See also this documentation for further description: http://help.sap.com/saphelp_nw04/helpdata/en/fd/fe573d675e910fe10000000a114084/frameset.htm.
Now the question:
I would like to display one single command (See Also) as the last property, which will make the search result look like this:
Icon - Heading
Relevancy - Description
Rating - Properties (like modifiedby, contentlength AND See Also)
Is it possible to dislay the command here? And if it is possible, how do I display the command here? Should I enter something like "rnd:see_also_extern" in the Search Result Renderer Settings?
Any help will be rewarded
Regards,
MartinHello Prakash
Thank you very much, it solved my problem! Ten points.
As a side question: I noticed that it is not possible to change the text style of the command using "/secondaryTextStyle". Do you know about another way to change the text style? Or is changing the text style of commands and displayname not a part of FlexUI?
Regards,
Martin -
Display two heading in single column using ALV report
Hi Experts,
I got a requirement for displaying 2 rows heading in a single column report. Is it possible that I can perform this task using ALV. How to get this 2 rows in ALV.
This is a criteria that need to be output in ALV REPORT.
MATERIAL CODE--MATERIAL NUMBERSTORAGE LOC----SLOC1 SLOC2
--DATE--DATE1 DATE2
123445--TEST MATERIAL22--
3
As mentioned above storage loc and date will be changing with respect to data dynamically and under this double heading qty will be displayed.
Just want to know how to get double heading. It is clear that how to display dynamically but unaware of double heading using fieldcatalog.
Regards,
YahyaHi Yahya,
Please pass row position in fieldcatalogue for the respective columns.
E.g MOVE '2' to w_fieldcat-row_pos. " This will display the field in 2nd row.
Thanks,
Rupali -
Displaying Document Name With The Summary in a Single Column Using Document Library View.
Hi All,
I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the
row to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page.
So could you someone help me to solve this matter?
Thanks and regards,
ChiranthakaHI Chiranthaka,
You can create DataView webpart using SPD and then modify the display template according to your need.
http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
Hope this will help to solve your problem.
Best Regards,
Brij K -
Displaying Document Name & The Summary in a Single Column Using Document Library View
Hi All,
I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the row
to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page.
So could you someone help me to solve this matter?
Thanks and regards,
ChiranthakaHI Chiranthaka,
You can create DataView webpart using SPD and then modify the display template according to your need.
http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
Hope this will help to solve your problem.
Best Regards,
Brij K -
Displaying 2 columns in a single column using HTML section of reports.
Hi Team,
I have a requirement in which we need to display 2 columns in the same column of OBIEE report. At present we have 2 columns as 2 different columns.
For example if i have a column A which is used as @A in html section i need the new column to have @A + @B where B is another column in database.
Can i concatenate 2 columns in a single column ?
Thanks,
Riteshfirst select column 1 and column 2 in criteria.
go to reaults are add narrater view.
in narrater view type.
@1@2[br/]
set number of rows
this should work in narrator.
Edited by: user10615659 on May 20, 2013 4:30 PM -
Display of data in a single row
Hi
Here is my query:
SELECT
--Element Classification Details:
pec.CLASSIFICATION_ID,
pec.classification_name,
pec1.classification_id "Sub Classification Id",
DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions',
'Others Voluntary Deductions', 'Other Deductions',
'Personal Deductions', 'Personal Deductions',
'Personal Voluntary Deductions', 'Personal Deductions',
'Car Loan Deductions') "Sub Classification",
pec1.parent_classification_id,
scr.sub_classification_rule_id,
--Element Details:
pet.element_name, pet.element_type_id, pet.reporting_name,
DECODE(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
--Run Result Details:
prr.run_result_id,
TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)) "Amount",
piv.NAME "Input Value",
--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"
FROM hr.pay_element_classifications pec,
hr.pay_element_classifications pec1,
hr.pay_sub_classification_rules_f scr,
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
WHERE
pec.classification_id = pec1.parent_classification_id (+)
AND scr.classification_id = pec1.classification_id
AND pet.classification_id = pec.classification_id
AND scr.element_type_id = pet.element_type_id
AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
AND prr.run_result_id = prrv.run_result_id
AND piv.input_value_id = prrv.input_value_id
AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
AND ptp.TIME_PERIOD_ID = payroll.time_period_id
AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
AND pec1.classification_name LIKE '%Deduction%'
AND piv.name = 'Pay Value'
AND paa.payroll_id != 0
AND paa.pay_basis_id != 0
AND paa.ASSIGNMENT_ID = '560'
I needed to display the amounts as separate columns pertaining to different elements or rather different sub classification of the elements
This is the final expected result for the report:
Employee Personal Deductions PD Amount Other Deductions OD Amt
XYZ Element1 00000.00 Element3 0000.00
Element 2
Car Loan Deductions CLD Amt Total Deductions (Total of all three)
Element4 00000.00 00000000.00
Here Personal Deductions, Other, Car Loan etc. are grouping of elements (sub classifications)
I have used MAX function to display the results as separate columns like this:
SELECT
--Run Result Details:
prr.run_result_id,
MAX(DECODE(pec1.classification_name, 'Personal Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal Deductions",
MAX(DECODE(pec1.classification_name, 'Personal Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal V Deductions",
MAX(DECODE(pec1.classification_name, 'Other Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Other Deductions",
MAX(DECODE(pec1.classification_name, 'Others Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Others V Deductions",
MAX(DECODE(pec1.classification_name, 'Car Loan Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Car Loan Deductions"
/*--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"*/
FROM hr.pay_element_classifications pec,
hr.pay_element_classifications pec1,
hr.pay_sub_classification_rules_f scr,
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv
/*hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp*/
WHERE
pec.classification_id = pec1.parent_classification_id (+)
AND scr.classification_id = pec1.classification_id
AND pet.classification_id = pec.classification_id
AND scr.element_type_id = pet.element_type_id
AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
AND prr.run_result_id = prrv.run_result_id
AND piv.input_value_id = prrv.input_value_id
/*AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
AND ptp.TIME_PERIOD_ID = payroll.time_period_id
--and pet.element_NAME like 'IVTB%'
AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE*/
AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
AND pec1.classification_name LIKE '%Deduction%'
AND piv.name = 'Pay Value'
--and paa.PRIMARY_FLAG like 'Y%'
/*AND paa.payroll_id != 0
AND paa.pay_basis_id != 0*/
GROUP BY
prr.run_result_id
However, the fact is that my each element_type_id has each run_result_id, which means 1 element has 1 run result id. Thus, I cannot display the data in a single row.
Can someone guide me on this? How can I display the data for an employee as a single row?
Thanks and regards,
AparnaSELECT EMP_ID,
Sum(Decode(DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions','Others Voluntary Deductions', 'Other Deductions'),'Other Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Other deduction',
sum(Decode(DECODE(pec1.classification_name,'Personal Deductions', 'Personal Deductions', 'Personal Voluntary Deductions', 'Personal Deductions'),'Personal Deductions'),TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Personal deduction',
sum(DECODE(pec1.classification_name,'Car Loan Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Car deduction'
FROM hr.pay_element_classifications pec,
hr.pay_element_classifications pec1,
hr.pay_sub_classification_rules_f scr,
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
WHERE
pec.classification_id = pec1.parent_classification_id (+)
AND scr.classification_id = pec1.classification_id
AND pet.classification_id = pec.classification_id
AND scr.element_type_id = pet.element_type_id
AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
AND prr.run_result_id = prrv.run_result_id
AND piv.input_value_id = prrv.input_value_id
AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
AND ptp.TIME_PERIOD_ID = payroll.time_period_id
AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
AND pec1.classification_name LIKE '%Deduction%'
AND piv.name = 'Pay Value'
AND paa.payroll_id != 0
AND paa.pay_basis_id != 0
I hope this may help!
Brijesh -
Library Filters: Filter for multiple values in a single column and Wildcards
If you have a multi-value column in a library, can you filter to show only results where two (or more) specific values (terms) are applied? E.g. Year 2014 and Month January? Seems this would be particularly useful for Enterprise Keywords columns.
Similarly, is there any way to filter on one value OR another value in a single column (e.g. Document Type Memo OR Fax)?
Any way to use wildcards in searches (would be REALLY useful in the Title and Name columns when naming conventions have been followed).
I'm guessing the answer is going to be 'move to SharePoint 2013' - if that is the case, please confirm whether all the scenarios mentioned above are catered for.Thanks for your replies !
Is there any other way to achieve this ?
There is 1 InfoObject which has 2 fields Employee and Department.
Employee Department
001 A
001 B
001 C
In the report there should be 1 row for Employee 001 with all the Departments displayed in the same cell separated by commas.
Can this be done in the backend through a ABAP code? -
Is it possible to apply a condition on a single column?
Morning All,
Is it possible to apply a condition on a single column? My aim is to create a report that has multiple PTD columns, each based on a different Version ID.
I've tried creating a calculation using the case statement shown below, however I get a blank column with nothing in: CASE WHEN VERSION_ID = ‘10’ THEN BALANCES.PTD END
I know this can be done through a DB view/custom folder, however I’m looking for a solution that can be created in Desktop / Plus.
Cheers,
LanceOK. Hope this explains the problem well.
This is the Crosstab Report without Annual Budget Column which looks great, all figures correct.
http://vodashare.com/show.php/2929_Pic1.jpg
After Adding Annual Budget column,
http://vodashare.com/show.php/2930_Pic2.jpg
This is the Table version of the above report with Annual Budget column
http://vodashare.com/show.php/2931_Pic3.jpg
Calculation Used for Annual Budget is
SUM(( CASE WHEN ( ( Actual Flag = 'B' ) AND ( Status <> 'C' ) )
THEN ( NVL(Period To Date Cr,0)-NVL(Period To Date Dr,0) )
ELSE 0 END ))
OVER(PARTITION BY Account,"Period Year" )
According to the conditions ( Actual Flag = 'B' ) AND ( Status <> 'C' ), amount is calculated adding the (Cr – Dr) amount when these conditions are satisfied. But, How can I make sure the value is displayed only for rows that these conditions are satisfied?
As you can see, it also displays the columns where Actual Flag != 'B' and Status = ‘C’
Also, I wonder why the Crosstab worksheet with Annual Budget doesn’t display some of the amounts (Ex: for Account 301010, no Annual Budget is displayed where as in Tabular worksheet it is $5721017.50) and for the amounts displayed, why are they displayed at different levels of Sub Accounts?
Note: I do get a warning when I Add the Annual Budget to worksheet.
'You are combining a detail data point with an aggregate data point This may give you unexpected results'. But I am not using any detail items as data points.(not considering Status and Actual Flag, got same message even after removing those)
Please let me know if you find a solution for your requirement Lance, that would help me. -
New to Graphics, trying to display array output in a single window
I am trying to figure out how to use the GUI components of JAVA.
What I am trying to do is take my packaged array output and list it in a single window. All that ever prints is last array data set. The last keeps overwritting the previous. How do I keep the previous data shown while listing the next in the array?
Below are my three classes. The Frame Class is the class containing the display method. It is called near the bottom of the Product Class.
Product.java
// Inventory Program Part 4
/* This program will store multiple entries
for office supplies, give the inventory value,
sort the data by Product Name,
and output the results using a GUI */
import javax.swing.text.JTextComponent;
import javax.swing.JLabel;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JOptionPane; //Uses class JOptionPane
import java.util.Scanner; //Uses class Scanner
import java.util.Arrays; //Uses class Arrays
public class Product
private String productBrand[]; // Declares the array
public void setProductBrand( String brand[] ) // Declare setProductBrand method
productBrand = brand; // stores the productbrand
} // End setProductBrand method
public String getProductBrand( int counter ) // Declares getProductBrand method
return productBrand[ counter ]; // Returns data using counter to define the element
} // End method getProductBrand
public double restockingFee( double value ) // Declares restocking Fee method
double fee = 0; // Declares variable fee
fee = value * 0.05; // Calculates the sum of values
return fee; // Returns the restocking fee
} // End method restockingFee
public String inventoryValue( double value[] , int number, String name[] ) // Declares inventoryValue method
OfficeSupplies myOfficeSupplies = new OfficeSupplies(); //Creates OfficeSupplies Object
Product myProduct = new Product();
double total = 0; // Declares variable total
for ( int counter = 0; counter < number ; counter++ )
total += ( value[ counter ] + myProduct.restockingFee( value[ counter ] ) ); // Calculates the sum of values
return String.format( "%s$%.2f", "Total Inventory Value: " , total ); // Returns the total value
} // End method inventoryValue
// main method begins execution
public static void main( String args[] )
Scanner input = new Scanner( System.in ); //Creates Scanner object to input from command window
Product myProduct = new Product(); //Creates Product object
OfficeSupplies myOfficeSupplies = new OfficeSupplies(); //Creates OfficeSupplies Object
//Prompt for maxNumber using JOptionPane
String stringMaxNumber =
JOptionPane.showInputDialog( "Enter the number of products you wish to enter" );
int maxNumber = Integer.parseInt( stringMaxNumber );
String prodName[] = new String[ maxNumber ]; // Declares prodName array
int numberUnits[] = new int[ maxNumber ]; // Declares maxNumber array
float unitPrice[] = new float[ maxNumber ]; // Declares unitPrice array
double value[] = new double[ maxNumber ]; // Declares value array
String brand[] = new String [ maxNumber ]; // Declares brand array
String stringNumberUnits[] = new String [ maxNumber]; // Declares array
String stringUnitPrice[] = new String [ maxNumber ]; // Declares array
int productNumber[] = new int[ maxNumber ]; // Declares array
for ( int counter = 0; counter < maxNumber; counter++ ) // For loop for the number of products to enter
productNumber[ counter ] = counter;
myOfficeSupplies.setProductNumber( productNumber ); // Sends the Product name to method setProductNumber
//Prompt for product name using JOptionPane
prodName[ counter ] =
JOptionPane.showInputDialog( "Enter the Product Name" );
myOfficeSupplies.setProductName( prodName ); // Sends the Product name to method setProductName
//Prompt for brand name using JOptionPane
brand[ counter ] =
JOptionPane.showInputDialog( "Enter the Brand name of the Product" );
myProduct.setProductBrand( brand ); // Sends the Brand name to method setProductBrand
//Prompt for number of units using JOptionPane
stringNumberUnits[ counter ] =
JOptionPane.showInputDialog( "Enter the Number of Units" );
numberUnits[ counter ] = Integer.parseInt( stringNumberUnits[ counter ] );
myOfficeSupplies.setNumberUnits( numberUnits ); // Sends the Number Units to the method setNumberUnits
//Prompt for unit price using JOptionPane
stringUnitPrice[ counter ] =
JOptionPane.showInputDialog( "Enter the Unit Price" );
unitPrice[ counter ] = Float.parseFloat( stringUnitPrice[ counter ]);
myOfficeSupplies.setUnitPrice( unitPrice ); // Sends the Unit Price to the method setUnitPrice
value[ counter ] = numberUnits[ counter ] * unitPrice[ counter ]; // Calculates value for each item
myOfficeSupplies.setProductValue( value ); // Sends the product value to the method setProductValue
Arrays.sort( prodName, String.CASE_INSENSITIVE_ORDER ); // Calls method sort from Class Arrays
Frame myFrame = new Frame();
myFrame.displayData( myProduct, myOfficeSupplies, maxNumber );
// Outputs Total Inventory Value using a message dialog box
JOptionPane.showMessageDialog( null, myProduct.inventoryValue( value, maxNumber, prodName ),
"Total Inventory Value", JOptionPane.PLAIN_MESSAGE );
} // End method main
} // end class ProductOfficeSupplies.java ----> This is the data container
// Inventory Program Part 4
/* Stores the array values */
public class OfficeSupplies // Declaration for class Payroll
private int productNumber[];
public void setProductNumber( int number[] ) // Declare setProductNumber method
productNumber = number; // stores the product number
} // End setProductNumber method
public int getProductNumber( int counter ) // Declares getProductNumber method
return productNumber[ counter ];
} // End method getProductNumber
private String productName[];
public void setProductName( String name[] ) // Declare setProductName method
productName = name; // stores the Product name
} // End setProductName method
public String getProductName( int counter ) // Declares getProductName method
return productName[ counter ];
} // End method getProductName
private int numberUnits[];
public void setNumberUnits( int units[] ) // Declare setNumberUnits method
numberUnits = units; // stores the number of units
} // End setNumberUnits method
public int getNumberUnits( int counter ) // Declares getNumberUnits method
return numberUnits[ counter ];
} // End method getNumberUnits
private float unitPrice[];
public void setUnitPrice( float price[] ) // Declare setUnitPrice method
unitPrice = price; // stores the unit price
} // End setUnitPrice method
public float getUnitPrice( int counter ) // Declares getUnitPrice method
return unitPrice [ counter ];
} // End method getUnitPrice
private double productValue[];
public void setProductValue( double value[] ) // Declare setProductValue method
productValue = value; // stores the product value
} // End setProductValue method
public double getProductValue( int counter ) // Declares getProductValue method
return productValue[ counter ];
} // End method getProductValue
} // end class OfficeSuppliesFrame.java ------> Contains the display method
import java.awt.Color;
import javax.swing.text.JTextComponent;
import javax.swing.JLabel;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JOptionPane; //Uses class JOptionPane
public class Frame extends JFrame
public Frame() //Method declaration
super( "Products" );
} // end frame constructor
public void displayData( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
//Here I attempted to use an array to output all of the array data in a single window
// JTextArea myTextArea[] = new JTextArea[ maxNumber ]; // Declares myTextArea array to display output
JTextArea myTextArea = new JTextArea(); // textarea to display output
// For loop to display data array in a single Window
for ( int counter = 0; counter < maxNumber; counter++ ) // Loop for displaying each product
// myTextArea[ counter ].setText( packageData( myProduct, myOfficeSupplies, counter ) + "\n" );
// add( myTextArea[ counter ] ); // add textarea to JFrame
myTextArea.setText( packageData( myProduct, myOfficeSupplies, counter ) + "\n" );
add( myTextArea ); // add textarea to JFrame
} // End For Loop
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
setSize( 450, maxNumber*400 ); // set frame size
setVisible( true ); // display frame
public String packageData( Product myProduct, OfficeSupplies myOfficeSupplies, int counter ) // Method for formatting output
return String.format( "%s: %d\n%s: %s\n%s: %s\n%s: %s\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f",
"Product Number", myOfficeSupplies.getProductNumber( counter ),
"Product Name", myOfficeSupplies.getProductName( counter ),
"Product Brand",myProduct.getProductBrand( counter ),
"Number of Units in stock", myOfficeSupplies.getNumberUnits( counter ),
"Price per Unit", myOfficeSupplies.getUnitPrice( counter ),
"Total Value of Item in Stock is", myOfficeSupplies.getProductValue( counter ),
"Restock charge this product is", myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ),
"Total Value of Inventory plus restocking fee", myOfficeSupplies.getProductValue( counter )+
myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ) );
} // end method packageData
}Lets pretend that your assignment was to manage a list of employees of a store, and that each employee is identified by their name, position, and hourly wage. If you created a program along the lines of your current product program, I picture you creating three separate ArrayLists (or arrays), one for each variable, something like this:
import java.util.ArrayList;
public class MyEmployees1
private ArrayList<String> names = new ArrayList<String>();
private ArrayList<String> positions = new ArrayList<String>();
private ArrayList<Double> hourlyWages = new ArrayList<Double>();
public void add(String name, String position, double wage)
names.add(name);
positions.add( position);
hourlyWages.add(wage);
public void removed()
// TODO: I am nervous about trying to manage this!
//.......... more
}This program tries to manage three separate parallel arrays (arraylists actually). They are parallel because the 3rd item in the names list corresponds to the 3rd item in the positions list and also the hourlywages list. If I wanted to delete data, I'd have to be very careful to delete the correct item in all three lists. If I tried to sort one list, I'd have to sort the other two in exactly the same way. It is extremely easy to mess this sort of program up.
Now lets look at a different approach. Say we created a MyEmployee class that contains the employee's name, position, and wage, along with the appropriate constructors, getters, setters, toString method, etc... something like so:
import java.text.NumberFormat;
public class MyEmployee
private String name;
private String position;
private double hourlyWage;
public MyEmployee(String name, String position, double hourlyWage)
this.name = name;
this.position = position;
this.hourlyWage = hourlyWage;
public String getName()
return name;
public String getPosition()
return position;
public double getHourlyWage()
return hourlyWage;
public String toString()
// don't worry about these methods here. They're just to make the output look nice
NumberFormat currency = NumberFormat.getCurrencyInstance();
return String.format("Name: %-15s Position: %-15s Wage: %s",
name, position, currency.format(hourlyWage));
}Now I can create a MyEmployees2 class that holds a single list of MyEmployee objects, like so:
import java.util.ArrayList;
public class MyEmployees2
private ArrayList<MyEmployee> employeeList = new ArrayList<MyEmployee>();
public boolean add(MyEmployee employee)
return employeeList.add(employee);
public boolean remove(MyEmployee employee)
return employeeList.remove(employee);
public void display()
for (MyEmployee employee : employeeList)
System.out.println(employee);
public static void main(String[] args)
MyEmployees2 empl2 = new MyEmployees2();
empl2.add(new MyEmployee("John Smith", "Salesman", 20));
empl2.add(new MyEmployee("Jane Smyth", "Salesman", 25));
empl2.add(new MyEmployee("Fred Flinstone", "Janitor", 15));
empl2.add(new MyEmployee("Barney Rubble", "Supervisor", 35));
empl2.add(new MyEmployee("Mr. Spacely", "The Big Boss", 45));
empl2.display();
}Now if I want to add an Employee, I only add to one list. Same if I want to remove, only one list, and of course, the same for sorting. It is much safer and easier to do things this way. Make sense? -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Multiple Hotspots in a ALV Grid single column
Hi Experts,
My ALV Grid report output looks like below....
If you observe below output, column 3 has multiple documents each one separated by ' ; '. Now, I would like to assign hotspot on each documents like DOC1, DOC2, DOC3, etc.
Heading#: COL1 | COL2 | COL3 |
Records1: 1 | xxxxx | _DOC1_ ; DOC2 ; *DOC3*
Records2: 2 | xxxxx | _DOC1_ ; DOC5 ;
I know, we can assign hotspot for entire column. but my requirement is multiple hot spots in a single column.
Please help me on this?
Thanks in Advance
RaghuAs I mentioned earlier,
My ALV Grid report output looks like below....
Heading#: FIELD1 | FIELD2 | FIELD3 |
Records1: 1 | xxxxx | DOC1 ; DOC2 ; DOC3
Records2: 2 | xxxxx | DOC1 ; DOC5 ;
If you observe above output, field 3 has multiple documents each one separated by ' ; '.
When I click on DOC1, it supposed to display related picture on the POP-Up Screen. Similarly when I click on DOC2, it supposed to display that document picture on POP-up screen.
Before going to do this, first I need to assign hotspots on each documents like DOC1, DOC2, DOC3, etc.
Please help me.
Maybe you are looking for
-
Hello, Below I have posted code that I have on two different PHP files, tsearch12.php and votes12.php. The code works great. The file "tsearch12.php" uses AJAX to go to votes12.php to perform some functions. However, the first page has a variable cal
-
Network upgrade in small/medium business
Hello, I have been asked by a friend to do an upgrade to his business network. I would appreciate any help and suggestions. There are several things which need to be accomplished: Implement a VPN solution for remote access Increase bandwidth to supp
-
Hi, I'm a beginner with InDesign, and I need help badly. I've gone through lots of threads with no solution yet. Earlier today I exported an InDesign file to PDF and parts of the document with black text went to gray. It's been that way since, even i
-
Samsung LCD not working in Vista, but fine with OSX. Help!
Ok guys. I have read some of the posts on this topic, but they really haven't been helpful, so I am hoping someone can point me in the right direction. I have a Samsung 4671 TV, that when connected through DVI to HDMI on my MBP on OSX it works fine,
-
Aspect ratios exporting to quicktime
Apologies if this is a hoary old newbie question and please do point me in the right direction if there are other threads on the same topic. I'm editing a short originally shot on digibeta 16:9, then dumped down onto DV for digitising in. I'm having