Obtaining comma-separated list of text values associated with bitwise flag column

In the table msdb.dbo.sysjobsteps, there is a [flags] column, which is a bit array with the following possible values:
0: Overwrite output file
2: Append to output file
4: Write Transact-SQL job step output to step history
8: Write log to table (overwrite existing history)
16: Write log to table (append to existing history)
32: Include step output in history
64: Create a Windows event to use as a signal for the Cmd jobstep to abort
I want to display a comma-separated list of the text values for a row. For example, if [flags] = 12, I want to display 'Write Transact-SQL job step output to step history, Write log to table (overwrite existing history)'.
What is the most efficient way to accomplish this?

Here is a query that gives the pattern:
DECLARE @val int = 43
;WITH numbers AS (
   SELECT power(2, n) AS exp2 FROM (VALUES(0), (1), (2), (3), (4), (5), (6)) AS n(n)
), list(list) AS (
   SELECT
     (SELECT CASE WHEN exp2 = 1  THEN 'First flag'
                  WHEN exp2 = 2  THEN 'Flag 2'
                  WHEN exp2 = 4  THEN 'Third flag'
                  WHEN exp2 = 8  THEN 'IV Flag'
                  WHEN exp2 = 16 THEN 'Flag #5'
                  WHEN exp2 = 32 THEN 'Another flag'
                  WHEN exp2 = 64 THEN 'My lucky flag'
             END + ', '
      FROM   numbers
      WHERE  exp2 & @val = exp2
      ORDER BY exp2
      FOR XML PATH(''), TYPE).value('.', 'nvarchar(MAX)')
SELECT substring(list, 1, len(list) - 1)
FROM   list
Here I'm creating the numbers on the fly, but it is better to have a table of numbers in your database. It can be used in many places, see here for a short discussion:
http://www.sommarskog.se/arrays-in-sql-2005.html#numbersasconcept
(Only read down to the next header.)
For FOR XML PATH thing is the somewhat obscure way we create concatenated lists. There is not really any using trying to explain how it works; it just works. The one thing to keep in mind is that it adds an extra comma at the end and the final query strips
it off.
This query does not handle that 0 has a special meaning - that is left as an exercise to the reader.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • How to get distinct values in a comma separated list of email addresses?

    Hi Friends,
    I have a cursor which fetches email address along with some other columns. More than one record can have same email address.
    Ex
    CURSOR C1 IS
    SELECT 1 Buyer,'XX123' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 2 Buyer,'XX223' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 1 Buyer,'XX124' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 2 Buyer,'XX224' PO, '[email protected]' Buyer_email from dualNow, i open the cursor write the contents into a file and also form a comma separated list of buyer emails as follows
    for cur_rec in c1
    LOOP
    --write contents into a file
    l_buyer_email_list := l_buyer_email_list||cur_rec.buyer_email||',';
    END LOOP
    l_buyer_email_list := RTRIM(l_buyer_email_list,',');
    The buyer email list will be like: '[email protected],[email protected],[email protected],[email protected]'
    Inorder to avoid duplicate email address in the list, i can store each of this value is a table type variable and compare in each iteration whether the email already exist in the list or not.
    Is there any other simpler way to achieve this?
    Regards,
    Sreekanth Munagala.

    If you are using oracle version 11, you can use listagg function
    with c as
    (SELECT 1 Buyer,'XX123' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 2 Buyer,'XX223' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 1 Buyer,'XX124' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 2 Buyer,'XX224' PO, '[email protected]' Buyer_email from dual
    select buyer, listagg(buyer_email,',') within group (order by  buyer) 
    from c
    group by buyer
    order by buyerFor prior versions
    {cod}
    with c as
    (SELECT 1 Buyer,'XX123' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 2 Buyer,'XX223' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 1 Buyer,'XX124' PO, '[email protected]' Buyer_email from dual
    UNION ALL
    SELECT 2 Buyer,'XX224' PO, '[email protected]' Buyer_email from dual
    select buyer, rtrim(xmlagg(xmlelement(e,buyer_email||',').extract('//text()')),',')
    from c
    group by buyer
    order by buyer

  • Comma separated list for in ()

    I am trying get a comma separated list of numbers (123,345,332,645) from a text field and pass it to a select statement that has in condition. The code looks something like
    select a,b,c from tab1
    where a in (:P1_SEARCH)
    This works when I put only one value in the field. if I put two values like 345,453 it doesn't.
    Can someone please explain this behaviour?
    Thank you,
    Kirtan Desai

    Kirtan,
    Lots of info here: Re: Search on a typed in list of values .
    Scott

  • Problem using comma separated list with nested table element

    Hi,
    I have a comma separated list like that:
    H23004,H24005,T7231,T8231,T9231And want to create a function which is creating a where clause for each element with an output like that:
    UPPER('H23004') IN (UPPER(charge))
    OR UPPER('H23005') IN (UPPER(charge))
    OR UPPER('T7231') IN (UPPER(charge))
    OR UPPER('T8231') IN (UPPER(charge))
    OR UPPER('T9231') IN (UPPER(charge))Here is my test function which doesn't work correctly:
    create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is
    -- declaration of list type
    TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE;
    -- variable for Batches
    v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || '''');
    return_script varchar2(1000);
    BEGIN
    -- loop as long as there are objects left
    FOR i IN v_batch.FIRST .. v_batch.LAST
    LOOP
       --DBMS_OUTPUT.PUT_LINE(offices(i));
       -- create where clause
       IF i = 1 THEN
         return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       ELSE
         return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       END IF;
    END LOOP;
    return (return_script);
    end;The out put looks like that:
    UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))I have no idea what I do wrong? It calculates the amount of array element wrong! (v_batch.LAST should be 5.)
    v_batch.FIRST = 1
    v_batch.LAST = 1
    Regards,
    Tobias

    try this....
    declare
    text varchar2(1000) := 'H23004,H24005,T7231,T8231,T9231';
    v_where varchar2(1000);
    begin
    text := text||',';
    while instr(text,',') <> 0
    loop
    v_where := v_where || 'UPPER('''||substr(text,1,instr(text,',',1)-1)||''' IN (UPPER(charge)) OR ';
         text := substr(text,instr(text,',',1)+1);
    end loop;
    v_where := substr(v_where,1,length(v_where)-3);
    dbms_output.put_line(v_where);
    end;
    convert this one into function ...

  • Forms.INS(72) No String value associated with this variable

    When I try to distribute my application I need to make sure that
    when my app installs it either adds or creates the environment
    variable Forms60_Path. This can be done in the project
    builder. When going through this one of the steps you have
    ability to add new environment variables. So I add on one named
    Forms60_Path with a value and contents of %PROD_HOME% and with
    the append set to yes.
    This now will give me either one or two errors when installing
    the application. The first error is that because i am choosing
    append set to yes it doesn't appear to be checking if the
    variable is already there or not. What it does do is give me a
    messages saying "A file not found while trying to translate
    Forms60_Path from '$Oracle' would u like to retry, ignore or
    process' I have choosen to process and the installer correctly
    adds the registry entry. That is a good thing but i still
    should not recieve an error when doing this it should check to
    see if the Reg entry is there if not then create it, if it is
    there then append to it. This only happens if you have append
    set to yes and the environment variable does not exist in the
    registry yet.
    The second error is more concerning because it just cancels out
    of the install all together. What it does no matter what under
    any circurmstance after you have added an environment variable
    in the delivery wizard is give u a message saying that
    "Form_Name.INS(72) No String Value associated with this
    variable" This error always comes up no matter what. After
    looking throught the INS file I took out the line
    "win32_register_map_variable(repl_var);" and I no longer
    recieved that error. My question is why do I get this error and
    what is the ramifications of taking this line out of the INS
    file?
    If no one else has had these problems I will be simply amazed!!!
    Thanks,
    Spencer Tabbert
    null

    Spencer,
    I am also getting the error you got months ago. (The second one: FORM.ins(72): No string value associated with this variable.) Can you tell me how you were able
    to fix it? I would appreciate it.
    I am new to Project Builder and pretty
    confused.
    Thanks,
    Monika

  • Assign focus on text field associated with tree item in edit mode

    The JavaFX home page has an example for how to edit the label associated with a tree item using a cell factory (see sample code below). However, if you select a tree item and then either mouse click or select the Enter key to start editing, the text field doesn't get focus even though the startEdit() method invokes textField.selectAll(). I tried invoking textField.requestFocus(), but that didn't work. Is there a way to ensure that the text field gets focus when the tree item is in edit mode?
    I'm using JavaFX 2.1 GA version on Windows 7.
    Thanks.
    Stefan
    @Override
    public void startEdit() {
    super.startEdit();
    if (textField == null) {
    createTextField();
    setText(null);
    setGraphic(textField);
    textField.selectAll();
    public class TreeViewSample extends Application {
    private final Node rootIcon =
    new ImageView(new Image(getClass().getResourceAsStream("root.png")));
    private final Image depIcon =
    new Image(getClass().getResourceAsStream("department.png"));
    List<Employee> employees = Arrays.<Employee>asList(
    new Employee("Ethan Williams", "Sales Department"),
    new Employee("Emma Jones", "Sales Department"),
    new Employee("Michael Brown", "Sales Department"),
    new Employee("Anna Black", "Sales Department"),
    new Employee("Rodger York", "Sales Department"),
    new Employee("Susan Collins", "Sales Department"),
    new Employee("Mike Graham", "IT Support"),
    new Employee("Judy Mayer", "IT Support"),
    new Employee("Gregory Smith", "IT Support"),
    new Employee("Jacob Smith", "Accounts Department"),
    new Employee("Isabella Johnson", "Accounts Department"));
    TreeItem<String> rootNode =
    new TreeItem<String>("MyCompany Human Resources", rootIcon);
    public static void main(String[] args) {
    Application.launch(args);
    @Override
    public void start(Stage stage) {
    rootNode.setExpanded(true);
    for (Employee employee : employees) {
    TreeItem<String> empLeaf = new TreeItem<String>(employee.getName());
    boolean found = false;
    for (TreeItem<String> depNode : rootNode.getChildren()) {
    if (depNode.getValue().contentEquals(employee.getDepartment())){
    depNode.getChildren().add(empLeaf);
    found = true;
    break;
    if (!found) {
    TreeItem<String> depNode = new TreeItem<String>(
    employee.getDepartment(),
    new ImageView(depIcon)
    rootNode.getChildren().add(depNode);
    depNode.getChildren().add(empLeaf);
    stage.setTitle("Tree View Sample");
    VBox box = new VBox();
    final Scene scene = new Scene(box, 400, 300);
    scene.setFill(Color.LIGHTGRAY);
    TreeView<String> treeView = new TreeView<String>(rootNode);
    treeView.setEditable(true);
    treeView.setCellFactory(new Callback<TreeView<String>,TreeCell<String>>(){
    @Override
    public TreeCell<String> call(TreeView<String> p) {
    return new TextFieldTreeCellImpl();
    box.getChildren().add(treeView);
    stage.setScene(scene);
    stage.show();
    private final class TextFieldTreeCellImpl extends TreeCell<String> {
    private TextField textField;
    public TextFieldTreeCellImpl() {
    @Override
    public void startEdit() {
    super.startEdit();
    if (textField == null) {
    createTextField();
    setText(null);
    setGraphic(textField);
    textField.selectAll();
    @Override
    public void cancelEdit() {
    super.cancelEdit();
    setText((String) getItem());
    setGraphic(getTreeItem().getGraphic());
    @Override
    public void updateItem(String item, boolean empty) {
    super.updateItem(item, empty);
    if (empty) {
    setText(null);
    setGraphic(null);
    } else {
    if (isEditing()) {
    if (textField != null) {
    textField.setText(getString());
    setText(null);
    setGraphic(textField);
    } else {
    setText(getString());
    setGraphic(getTreeItem().getGraphic());
    private void createTextField() {
    textField = new TextField(getString());
    textField.setOnKeyReleased(new EventHandler<KeyEvent>() {
    @Override
    public void handle(KeyEvent t) {
    if (t.getCode() == KeyCode.ENTER) {
    commitEdit(textField.getText());
    } else if (t.getCode() == KeyCode.ESCAPE) {
    cancelEdit();
    private String getString() {
    return getItem() == null ? "" : getItem().toString();
    public static class Employee {
    private final SimpleStringProperty name;
    private final SimpleStringProperty department;
    private Employee(String name, String department) {
    this.name = new SimpleStringProperty(name);
    this.department = new SimpleStringProperty(department);
    public String getName() {
    return name.get();
    public void setName(String fName) {
    name.set(fName);
    public String getDepartment() {
    return department.get();
    public void setDepartment(String fName) {
    department.set(fName);
    Edited by: 882590 on May 22, 2012 8:24 AM
    Edited by: 882590 on May 22, 2012 8:24 AM

    When you click on a selected tree item to start the edit process is the text in the text field selected? In my case the text is not selected and the focus is not on the text field so I have to click in the text field before I can make a change, which makes it seem as if the method call textfield.selectAll() is ignored or something else gets focus after method startEdit() executes.

  • How can I see a list of the assets associated with a sequence?

    How can I see a list of the assets, both online and offline, associated with a sequence?

    Exporting an EDL or copying and pasting a timeline into a bin gives a complete list of the clips in a sequence, but what I really would like is a list of the files used, without any duplications due to multiple clips from a single reel. Is there any quick way to automatically generate such a list?

  • Getting text ID and Text object  associated with item texts in PO...

    Hi,
    To print standard text on smartform for a given item in purchase order, I need to find the text ID and object associated with it.
    There are various texts like item text, Info record PO text, Material PO Text, Delievry Text, etc...
    Now when I go to ME22N, and select item detail for any item -> Texts , how do I get text ID, and object associated with it ?

    Hi ,
        Use table stxh,stxl
        FM read_text.
        you can view the text id by following
        this link
         me23->header-text-double click on text->menu goto->
         header        
    Regards
    Amole

  • How to get the UIDRef of Text frame associated with hyperlink?

    Hi,
    I have a document which contains Text hyperlinks . I am able to get the number of hyperlinks present in document using "IHyperlinkTable" and text range to which hyperlink is associated using interface "IHyperlink".
    InterfacePtr<IHyperlink> hyperlink(tableDb, table->GetNthHyperlink(i), IID_IHYPERLINK);
    if(hyperlink)
           hyperlink->GetName(&sHyperlinkName); //sHyperlinkName is text to which hyperlink is associated
    now I need to find the UIDRef of Text frame with which hyperlink is associated.
    I can get the UIDRef of "Image frame" using interface "IHyperlinkPageItemSourceData".
    InterfacePtr<IHyperlinkPageItemSourceData> sourceHyperLink (tableDb, hyperlink->GetSourceUID(), UseDefaultIID());
    if (sourceHyperLink)
            UID sourceHyperLinkUID  = sourceHyperLink->GetSourceUID();
    but this interface may be not helpful in case of text in the frame (word/words) associated with hyperlink.
    If anyone has done this please do let me know.
    Thank you all in advance.
    Priyanka

    Hi All,
    I am still unable to get the solution of this issue. If anyone has done this please help me to find the solution.
    Thanks in advance.
    Priyanka

  • VC - Characterstics and Values associated with a Production Order

    Is there a way to get the variant configuration details (Characterstics and it's Values) related to a particular production order  which was created as a result of the selection of that component in the Super BOM.
    For. Ex   Let's  Say   Material A    has as super BOM containing components Material B, C, D, E
    Based on the Characterstics Values and Object dependencies Material B has been selected as the component that needs to be manufactured.
    Now i need to know dynamically the configuration values associated for the Production Order that got created for Material B.
    Something like i can pass the Production Order to some Function Module or something and get its characterstic values.
    Any thoughts or inputs is Greatly Appreciated.
    Best Regards,
    Bharat.

    Hi Mike,
    I remember your Inputs for my earlier VC Questions put in this forum back in April and Infact we made good progress based on your Great Inputs.
    However the scenario is somewhat different now,
    btw Guys, am trying to give a very detailed explanation below about the scenario, hence it might take a while to completely go through the details,  no offense -- Please be patient.
    to better explain,   We have a Multi-level Configuration Scenario.
    i.e   we are trying to follow a Top-fill model for one of our products i.e
    The Top-fill (like a wrapper )  will have two components blown in the Sales Order i.e
    Matnr A -- Top-fill 
    Matnr B - Configurable Component. 
    Matnr C - Non-Configurable Component.
    Matnr B is again a Multi-level Configurable  with configurable components i.e
    BOM of Matnr B looks like below,
    Matnr B  -- Configurable Component
    Matnr D - Configurable compoent
    Matnr D - Configurable component
    Matnr D - Configurable component
    Note: same Matnr D is repeated in the BOM  as the product structure  depends,
    and Finally this Matnr D has the actual Super BOM i.e
    --- Matnr D - Configurable compoent
    ActualComponent 1  - for which Prod. Order gets created
    Actual Component2  - for which Prod. Order gets created
    Actual Compoent 3    - for which Prod. Order gets created
    so if i explained it clearly you would understand that there is every possibility that sometimes based on the characterstic values chosen for Matnr D can endup choosing same ActualComponent.
    i.e let's say Customer has chosen certain characterstic values and based on the object dependencies it could end up something like below,
    --- Matnr A  -- Topfill          
    Matnr B - Configurble Material  
    MatnrD - Configurble material                                                       -                                                    -
    Actual Component 1
    MatnrD - Configurable material
    Actual Component 1
    MatnrD - Configurable material
    Actual Component 1
    since MatnrD and Actual Component 1 arent being blown in Sales Order but only in Configuration Results screen,  MatnrD OR Acutal Component 1 will not have any Reference Sales Order or Line Item.
    So when individual production orders get created for Actual Component 1's,  i have no idea which production order corresponds to which characterstic values of Matnr D. 
    I need to pass these characterstic values to Mfg. Systems.
    I know the above is quite complex but trying to find an Answer.
    I sincerely appreciate your Inputs.
    Please feel free to ask any Questions if you want some more clarifiction.
    Best Regards,
    Bharat.

  • Localisation in comma separated list issue

    Hello All,
    I am having an issue with Localisation objects on an irpt page not getting populated. For example I am passing a list of Localisation objects to a query param like so (note the behaviour is the same weather I am passing to a param or just outputing the localization on the irpt):
    "{##LOBJ_1},{##LOBJ_2},{##LOBJ_3},{##LOBJ_4},{##LOBJ_5},{##LOBJ_6}...."
    I expect to get a result like the folowing:
    "Text 1,Text 2,Text 3,Text 4,Text 5,Text 6..."
    But I get a result like this where some values have been popluated and some haven't.
    "Text 1,{##LOBJ_2},Text 3,Text 4,Text 5,{##LOBJ_2}..."
    I have no issue displaying any of the objects on thier own on the irpt.
    This issue is occuring on Version 12.0.4 Build(120), This issue does not occur for me on Version 12.0.2 Build(88)
    Regards,
    Christian

    Hi Christian,
    We have the same problem with the SP04.
    We made an OSS message on this problem.
    SAP must deliver the SP05 version soon.
    They have nevertheless said that the use of _ was discouraged.
    Regards
    Alexandre SEDANO

  • How to change list of values associated with a field using Personalization?

    Hi,
    We are using the standard Oracle TeleSales ASTCDDTL.fmb form 12.0.6 version. In that form, a field called "Type of School" is associate with the look up "HZ_TYPE_OF_SCHOOL". Now we need to customize the field to list down our list of countries (list of countries through a query of value set). Is there any way in Form Personalization we can achieve this? i.e changing the already associated look up type to a query or a custom value set?
    Appreciate your help on this!
    Thanks!
    Nithya

    959061 wrote:
    Hi,
    We are using the standard Oracle TeleSales ASTCDDTL.fmb form 12.0.6 version. In that form, a field called "Type of School" is associate with the look up "HZ_TYPE_OF_SCHOOL". Now we need to customize the field to list down our list of countries (list of countries through a query of value set). Is there any way in Form Personalization we can achieve this? i.e changing the already associated look up type to a query or a custom value set?
    Appreciate your help on this!
    Thanks!
    NithyaPlease see old threads -- https://forums.oracle.com/forums/search.jspa?threadID=&q=LOV+AND+Personalization&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How can I construct a list of text values in Table 2 from text values in Table 1:Column A, based upon a test value in Table 1:Column B?

    I am looking for a way to essentially import a select group of values from one table into another. If, for instance, I have a list of names in Column A and a list of colors in Column B, I would like to be able to compile a list of the names which coincide with each distinct color, and do so in a new table specific to that color. Probably an obvious solution, but I'm a relative newbie with Numbers and my spreadsheet experience is fairly limited so I apologize if this is embarrassingly rudimentary. Thanks in advance for any help you can give.

    You can extract a subset in a separate table by adding a helper index column to your table with the original data and using a formula in the separate table.
    But first, have you tried just using a filter on the table to view a subset of the data?  You would simply filter on a color in your Column B and would immediately see the names specific to that color in Column A.  And you could copy-paste those names elsewhere as needed.  No extra columns. No formulas. No fuss.
    SG

  • Query to fetch Comma separated list

    Hi all,
    i have a table like users below.
    I want to fetch the rows when to username is appeared in the in list.
    SQL> select * from users;
      PLATFORM USERS
             1 raja,ram,sathish
             2 raja,sathish
             3 vena,meena,sathish
    SQL> select * from users where lower(users)='raja,ram,sathish';
      PLATFORM USERS
             1 raja,ram,sathish
    SQL> select * from users where lower(users) like '%raja%';
      PLATFORM USERS
             1 raja,ram,sathish
             2 raja,sathishBut my requirement is even if the input list got changed,still it should retrieve that row..
    here the order of raja,sathish and ram has got changed.. But i need to retrieve the record..
    SQL> select * from users where lower(users) ='raja,sathish,ram';
    no rows selectedIs the any function to do this?

    WITH users AS (SELECT 1 platform, 'raja,ram,sathish' users FROM DUAL
                   UNION ALL
                   SELECT 2, 'raja,sathish' FROM DUAL
                   UNION ALL
                   SELECT 3, 'vena,meena,sathish' FROM DUAL
                   UNION ALL
                   SELECT 4, 'raja,sathish,ram' FROM DUAL),
             seach_string as (
                                      select length(str) - length(replace(str,',')) +1 count_us,','||regexp_substr(str||',', '[[:alpha:]]+.,', 1, level) us
                                      from
                                        select 'raja,ram,sathish' str from dual
                                      connect by level <= length(str) - length(replace(str,',')) +1 
    select *
    from users
    where users in
                    SELECT users
                      FROM users, seach_string
                    where instr(','||users||',', us) > 0
                    group by users
                    having count(*) = (select max(count_us) from seach_string)
      PLATFORM USERS            
             1 raja,ram,sathish 
             4 raja,sathish,ram 
    2 rows selected.

  • Sending a value associated with a checkbox across a client/server connectio

    Hello everyone,
    I've been working on a coursework for uni which simulates a very simple pizza ordering system. I've built the GUI and got the prices to calculate in a single applet. I'm now required to advance my application to perform a client/server connection, and to to my limited knowledge of java, have stumped myself! Please can someone help. I need to take the value of the 5 chech boxes in the client GUI and pass them to the server, which needs to calculate the total and pass it back to the client to show in a text box. My code thus far is:
    //client
    import java.applet.Applet;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    public class A3ClientClass_1 extends A4 {
         CheckboxGroup z;
         Checkbox tpizza, mpizza, ppizza, prpizza;
         Checkbox tomato, pepper, cheese, pepperoni, mushroom;
         String a = "";
         String b = "";
         TextField size, toppings, cost;
         double c;
    Scrollbar xAxis, yAxis;
    ScrollablePanel p;
    public void init() {
              setBackground(Color.orange);
    setLayout(new BorderLayout());
              Panel north = new Panel();
              north.add(new Label("SELECT THE PIZZA YOU WANT"));
              add(north, BorderLayout.NORTH);
              Panel outside = new Panel();
              outside.setBackground(Color.orange);
              z = new CheckboxGroup();
              tpizza = new Checkbox("Tomato Pizza", z, false);
              outside.add(tpizza);
              tpizza.addItemListener(this);
              mpizza = new Checkbox("Mushroom Pizza", z, false);
              outside.add(mpizza);
              mpizza.addItemListener(this);
              ppizza = new Checkbox("Pepper Pizza", z, false);
              outside.add(ppizza);
              ppizza.addItemListener(this);
              prpizza = new Checkbox("Pepperoni Pizza", z, false);
              outside.add(prpizza);
              prpizza.addItemListener(this);
              tomato = new Checkbox(" Tomatoes ");
              outside.add(tomato);
              tomato.addItemListener(this);
              pepper = new Checkbox(" Peppers ");
              outside.add(pepper);
              pepper.addItemListener(this);
              cheese = new Checkbox(" Cheese ");
              outside.add(cheese);
              cheese.addItemListener(this);
              pepperoni = new Checkbox(" Pepperoni ");
              outside.add(pepperoni);
              pepperoni.addItemListener(this);
              mushroom = new Checkbox(" Mushrooms");
              outside.add(mushroom);
              mushroom.addItemListener(this);
              size = new TextField(40);
              toppings = new TextField(40);
              cost = new TextField(40);
              outside.add(size);
              outside.add(toppings);
              outside.add(cost);
              tomato.disable();
              cheese.disable();
              pepper.disable();
              pepperoni.disable();
              mushroom.disable();
    p = new ScrollablePanel(outside);
    xAxis = new Scrollbar(Scrollbar.HORIZONTAL, 0, 50, 0, 100);
    yAxis = new Scrollbar(Scrollbar.VERTICAL, 0, 50, 0, 100);
    add("Center", p);
    add("East", yAxis);
    add("South", xAxis);
    public boolean handleEvent(Event e) {
    if (e.target instanceof Scrollbar) {
    p.transxy(xAxis.getValue(), yAxis.getValue());
    return true;
    return super.handleEvent(e);
         public void itemStateChanged(ItemEvent e) {
              b = "";
              c = 0;
              if (tpizza.getState() == true) {
                   a = tpizza.getLabel();
                   c = c + 3.00;
                   tomato.setState(true);
                   cheese.setState(true);
                   pepper.setState(false);
                   pepperoni.setState(false);
                   mushroom.setState(false);
              else if (mpizza.getState() == true) {
                   a = mpizza.getLabel();
                   c = c + 3.50;
                   tomato.setState(false);
                   cheese.setState(false);
                   pepper.setState(false);
                   pepperoni.setState(false);
                   mushroom.setState(true);
              else if (ppizza.getState() == true) {
                   a = ppizza.getLabel();
                   c = c + 4.00;
                   tomato.setState(false);
                   cheese.setState(true);
                   pepper.setState(true);
                   pepperoni.setState(false);
                   mushroom.setState(false);
              else if (prpizza.getState() == true) {
                   a = prpizza.getLabel();
                   c = c + 5.00;
                   tomato.setState(false);
                   cheese.setState(true);
                   pepper.setState(false);
                   pepperoni.setState(true);
                   mushroom.setState(false);
              if (tomato.getState() == true) {
                   b = b + tomato.getLabel() + " ";
                   c = c + 0.25;
              if (pepper.getState() == true) {
                   b = b + pepper.getLabel() + " ";
                   c = c + 0.5;
              if (cheese.getState() == true) {
                   b = b + cheese.getLabel() + " ";
                   c = c + 0.5;
              if (pepperoni.getState() == true) {
                   b = b + pepperoni.getLabel() + " ";
                   c = c + 1.0;
              if (mushroom.getState() == true) {
                   b = b + mushroom.getLabel() + " ";
                   c = c + 0.5;
              size.setText("Pizza Type: " + a);
              toppings.setText("Toppings: " + b);
              cost.setText("Total: �" + c);
         try{
                   Socket cts = new Socket(InetAddress.getLocalHost(), 6000);
                   DataInputStream isfs = new DataInputStream(cts.getInputStream());
                   DataOutputStream osts = new DataOutputStream(cts.getOutputStream());
                   while(true) {
                        //code here
              catch (IOException e) {
                        System.out.println(e);
    class ScrollablePanel extends Panel {
    int transx = 0;
    int transy = 0;
    Panel outside;
    public ScrollablePanel(Panel p) {
         setLayout(new BorderLayout());
         outside = p;
         add(outside);
    public void transxy(int x, int y) {
    transx = -x;
    transy = -y;
         outside.move(transx, transy);
    //Server
    import java.io.*;
    import java.net.*;
    public class A3ServerClass_1 {
         public static void main(String[] args) {
              try
                   ServerSocket ss = new ServerSocket(6000);
                   Socket ssconnect = ss.accept();
                   DataInputStream isfc = new DataInputStream(ctc.getInputStream());
                   DataOutputStream ostc = new DataOutputStream(ctc.getOutputStream());
                   while(true) {
    //code here
              catch (IOException e) {
                   System.out.println(e);
    Thanks

    Can't help ya there, I've never done socket programming. However, it comes up on these forums all the time. Try searching for some keywords about your problem.

Maybe you are looking for

  • Windows XP (SP3) won't boot

    I wonder if anyone here can help me. Neither the people at Apple, VMware or Microsoft can do so. Basically my VM powers on and I can see my Windows wallpaper. No desktop, no Start menu, no ability to safe boot (that I've been able to figure out). Any

  • Select boxes dependent on each other?

    Hi is there a way to use selectboxes / textfileds that depend on each other. select box 1. reads from database names select box 2. this one is filled when a chiose from box 1 is selected. (after a database question based on the result in box 1) inupt

  • Camera raw stuck in Spanish

    Any ideas are appreciated. Photoshop and Bridge are set to English, but every time I open camera raw it is set to Spanish and I can't figure out where to change the language. Mac OS 10.4.1 Thanks

  • Moving to unicode datatype for an entire database - SQL Server 2012

    Hi, I've a SQL Server 2012 database with more tables having more char and varchar columns. I'd like to change quickly char columns in nchar columns and varchar columns in nvarchar columns. Is it possible to solve this issue, please? Many thanks

  • Updating copied articles

    Will a copied article update if the original article is updated? Workflow example: I have two accounts: development and production In my "development" account, I created a folio [FOLIO_A]. Once it was approved, I shared FOLIO_A with "production". In