Better control flow?

Actually this is a general question I've been wondering for a while...
As the title states, I'm looking for a better control flow statement for what I planned.
I have 4 variables that determine types of pipe in a program in my main class. There are 6 possible pipe types.
For example Type 1 would have plastic grade = 5-7, color = 2, inner reinforcement = yes etc.
My main method determines which type the client chose, (if it matched one of the types or not so if all 4 were true then it matches x type.)
It's going to get really ugly if I use ifs and I don't think using a case statement would work.
Any suggestions in what I can use?

Unless you're just referring to getting user input and using it to look up a pipe >type?That would be what I'm doing, if I could figure out how to get the input variables from my applet class to the class that sorts out which pipe they picked.
Except the variables had to be defined within a method so the try catch statments could be added to them to catch the nfe as most of them are converted from String to int.
Let me suggest you to use nested switch case to solve the problemHmm, ok, I'll look into that. Would nested ifs suffice?
Message was edited by:
Yuriy_Ivanov

Similar Messages

  • Use control flow statement to evalute signals

    Hi,
    I have a number of steps in my sequence file such that when TS runs it looked like this:
    SignalA >20       pass
    Signal B <= 30   pass
    Now I wish to use some control flow statements like While and If loops so that I could create steps like this:
    While ( SignalA > 20)
    Problem is there are no "SignalA" in the TS expressions.  I tried putting together an expression like RunState.Sequence.?? (some unique id of the step)Result.step = "failed".  But the While loop can't seem to evaluate to True
    Any suggestion would be appreciated.
    Thanks!
    ph2

    Hey ph2,
    I'm not sure what your goal is with this but there is probably a better way to accomplish what you want.
    Where is SignalA coming from?  A VI?  A dll?  Do you only have to acquire it once or do you need to get it every iteration of the loop?  Is the step that acquires it inside the While statement or is it an asynchronous thread?  Why not just store it to a Local or FileGlobal and then access that.  It would be easier.
    BTW- If SignalA > 20 step is a Numeric Limit then you can access it by using Step.Result.Numeric. 
    Let me know exactly what your goal here is and I could possibly help you find a better solution.
    Cheers,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Use exception to control flow?

    I use validateExcelFile(File excelFile) to validate whether a file has valid excel format,
    when file is in invalid format, I have two options:
    1) return the error message in validate method:
    public String validateExcelFile(File excelFile) {
    String errorMsg = "";
    if(errorMsg.length == 0) {
    return null;
    } else {
    return errorMsg;
    Or
    2)Throw out a exception containing errorMsg
    public void validateExcelFile(File excelFile)
    throws InvalidExcelFormatException {
    String errorMsg = "";
    if(errorMsg.length != 0) {
    throw new InvalidExcelFormatException(errorMsg);
    The context in which the validate method is invoked needs to delete any invalid excel file according to the validate result, option 2 has the good that if there is another validate method and it also throws out the same exception when a file is invalid then I can place the two method in one
    try{
    validateMethod1( excelFile );
    validateMethod2( excelFile );
    } catch (InvalidFormatException ex) {  // deletes invalid file } statement, it is more clear than to check every method's returned error message, but I doubt whether it is good practice to control flow with exception instead of
    flow statements like if.
    Thanks.
    StuartS
    Edited by: StuartS on Oct 24, 2007 8:35 PM

    TimSparq wrote:
    You are correct, it is best practice not to controll flow with exceptions.
    Perhaps your validate message could just return a boolean and you can do something like:
    if (!validateExcelFile(file)) {
    // delete file
    Yeah, I was thinking of it more from a security validation standpoint, but if you simply want to accomplish an action as the result of a bad format, then you're definitely better off having a boolean function.

  • Better control over the creation of thumbnails

    While i have nothing against the current method of generating thumbnails with ADDT, I feel we need better controls as to how our thumbnails are created. By all means, the current option of generating thumbnails on the fly can remain, but I feel we need a tab on the image upload behaviour that allows us the developers to determine how our thumbnails are created.
    This will mainly happen during the image upload process. For example, in order to get uniform thumbnails, a developer could decide that he wants to crop his thumbnails to a certain size so that they can look good in a gallery. This i feel will come in pretty handy for those who are using Spry to create a photo gallery. At the moment, the one way you can create thumbnails on upload is to create a custom trigger and enter the required code to be executed after the file has been uploaded.
    So this feature will be welcomed i feel by many who are not too happy with the current method of generating thumbnails.

    I agree.
    Well said Emmanuel since the ADDT thumbnails are only created when requested by the display thumbnail server behavior. So some additional flexibility would be welcome. For example, when you do not wish to use the server behavior. Till then, we just have to use a custom trigger and to some ADDT users, thats advanced stuff.
    Cheers.

  • Dialog control flow case not opening in new browser window

    Hello -
    Using JDev 11gR1.
    I have a page fragment that contains a table of command links like so:
            <af:commandLink text="#{row.id}" id="cl2"
                            action="#{reportRunnerBean.runReportAction}"
                            useWindow="true" windowHeight="500" windowWidth="500">
              <f:param value="#{row.id}" name="reportId" id="p2"/>
            </af:commandLink>the runReportAction method returns the String: "dialog:runReport"
    in my page flow, the page fragment has a control flow case with the outcome "dialog:runReport" that leads to a URL View with the URL setting set to #{pageFlowScope.reportUrl}
    (the reportRunAction places a string in page flow scope with the key of "reportUrl". in case it matters, the url is external to the application)
    When I click on the link, I am directed to the correct URL. However, it does not open in a new browser window - it takes up the main browser window.
    Is there something obvious that I am doing wrong?
    Thank you for reading this,
    -- Scott

    Well, I couldn't figure out why the dialog wasn't working correctly, so I changed my page to use a server listener to handle the logic I wanted and just used af:goLink instead of a command link. That command link above became:
              <af:goLink text="#{row.id}" id="gl1"
                         destination="#{row.reportUrl}"
                         targetFrame="_blank">
                <af:clientAttribute name="reportId" value="#{row.id}"/>
                <af:clientListener method="logReport" type="click"/>
                <af:serverListener type="LogReportEvent"
                                   method="#{reportListBean.logReportInvocation}"/>
              </af:goLink>with the following client listener:
        <af:resource type="javascript">
          function logReport(evt) {
              var component = evt.getSource();
              var reportIdParam = component.getProperty("reportId");
              AdfCustomEvent.queue(component,
                                   "LogReportEvent",
                                   { reportId: reportIdParam}, false);
        </af:resource>and code in the bean:
        public void logReportInvocation(ClientEvent clientEvent) {
                String reportId =
                    (String)clientEvent.getParameters().get("reportId");
                //...do something w/reportId here...
        }Thanks to anyone who took the time to read this.

  • Programatically calling control flows from java code

    Hi all,
    I have a bounded taskFlow that uses pageFragments. This flow is a region in a page(.jspx).
    In my page fragment, I have a inputComboboxListOfValues with a ValueChangeListener code in a java bean.
    I want when a value is changed, to programatically call "controll flow" (this one has: "From Activity Id" -the page fragment with that inputComboboxListOfValues, and "To Activity Id" - the default Activity on this task Flow).
    So when the value change, practically I want to restart the flow programatically and pass the selected value as input parameter.
    Since the inputComboboxListOfValues is not like a button where in the "Action" property you can set the Control Flow and navigate somewhere, the only option I have is to programatically cause navigation from java code (example: the value change listener code).
    Can this be achieved?
    Any advice is helpfull.

    Hi,
    Absolutely, you can do it using the NavigationHandler. Try the following in you value change listener:
    FacesContext context = FacesContext.getcurrentInstance();
    NavigationHandler handler = context.getApplication().getNavigationHandler();
    handler.handleNavigation(context, null, outcome);
    // Render the response after that phase, the button actions should not be called
    context.renderResponse();
    // Add the following line if you want to prevent further value change listeners to be called
    // throw new AbortProcessingException();Regards,
    ~ Simon

  • Bounded-Task-Flow Page Fragment Control Flow Help

    jDeveloper: 11.1.1.0.2
    I am having an issue trying to figure out the correct way to use control flow cases between a bounded-task-flow with page fragments and an unbounded-task-flow page. We have taken the approach in our application to have a few shell / container pages to host bounded-task-flows made up of page fragments to facilitate re-usability and to speed up development. There are 4 or 5 shell pages on the applications unbounded-task-flow. As of now, we have about 20 page fragments that are implemented as bounded-task-flows. These fragments don't do much now, meaning there is only a single fragment in each bounded-task-flow. The issue I am having is trying to invoke a control flow navigation action from one of the fragments to load a different shell page.
    For Example, shellPage1.jspx contains fragment-flow-1 as a region. In my adfc-config.xml I have shellPage1.jspx and shellPage2.jspx, with control flow cases "toShell1" and "toShell2" respectively connecting the two pages. I have a link's action bound to the "toShell2" within the fragment that makes up fragment-flow-1. When the application is run, shellPage1.jspx and its fragment are displayed. But clicking on the link in the fragment ("toShell2") does absolutely nothing. It does not navigate me to the shellPage2.jspx as expected. What am I doing wrong here or do not understand?
    If the fragment is included as a JSP include, and not a bounded task flow include, everything works as expected. This is not desirable as we then need to copy the fragment's pageDef into the shellPage's pageDef to get the DataControls to function.
    If the faces-config.xml is used instead, and a JSF navigation case is used, it will also work as expected. This is not desirable because we really don't want to be mixing adcf-config and faces-config.
    So I am really stumped here.... Thanks in advance!

    Hi there:
    In your case, the adfc-config.xml has the control flow case between shell pages. And the task-flow-N.xml or your-task-flow.xml for each page fragment by default doesn't inherit control flow case from their containing shell page. In your case, in the page fragment task-flow.xml, you should add a "Parent Action" to flow to shell page2 for example. The outcome of "Parent Action" would be "toShell2" if calling from ShellPage1 page fragment.
    Is this 'Correct' or 'Helpful' for you? Please mark it as so if it does.
    Good luck,
    Alex

  • From where i can understand the control flow and architecture of JVM?

    i want to know control flow and architecture of JVM?
    Where i can know from?
    if some one wish to explain you can here also.

    makpandian wrote:
    No it s not broken.
    As per your experience,tell me some links.Per my experience I don't need links. I could build the VM both from the general level and the specific levels by referring only to the VM spec.
    And I read the book I suggested, first edition, years ago. Although with many other books.
    Conversely if I wanted to find a link now then I would use google.

  • Why do we want use 'Data Flow Task' to 'Data Flow Tast' in Control Flow?

    I found an example in my company's SSIS package folders. In Control Flow, it has one data flow connected to the other. Both of them are importing data from flat file and then exported to database. I think these two are kind of at the same level and cannot
    see any reasons to conncect them together.
    Thanks & Happy Thxgiving,
    Gavin 

    Hi Gavin,
    Just as Arthur said, if there is no relationship between those two data flow tasks, we don’t have to connect them together. If they connect together, maybe there are some relationship between them.
    According to your description, both of the data flow tasks are importing data from flat file and then exported to database. It seems that there is no direct relationship between them. Another possibility is that there is a precedence constraint between them.
    The precedence constraint can be based on a combination of the first execution results and the evaluation of expressions. We can check the issue by double-check the connection string between them.
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Setting Control-Flow- Case on java class/method

    hello All :D
    i have little problem about control flow case, in my case i've 2 page where before load to the page i'wanna make condition (if-else)
    when the user choose the field, the java class get the value for make true condition. In this case, i wanna implement ControlFlowCase in java class/method, so anyone help..?
    thx
    agungdmt

    Have you considered using router activity - http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/taskflows_activities.htm#CJHFFGAF ?

  • Ssis data flow item and ssis control flow item tab missing in choose toolbox item from ssdt 2010

    ssis data flow item and ssis control flow item  tab missing in choose toolbox item from ssdt 2010

    I have the same problem.
     When i click on tools -> choose tools Items dialog box, Control Flow and Data Flow Tab are missing.
    I've just worked with SQL Server Data Tools and SQL Server 2012 and these tabs are not missing.
    i think this is a problem installing SQL Server.
    I've not yet  found a solution.

  • Control flow case to return from any page to start page!

    I need to use a Image Link at Master Page for go to "Start page". but when i use control flow case don't work.
    How can i assign a control flow case in a master page?
    My djeveloper version is 11.1.2.3

    You have to define what you mean by master page and start page. Are both pages are on the same talk flow?
    What do you mean by 'the navigation doesn't work'? Do you get an error?
    Normally you implement a wild card navigation which points to the start page. This navigation you use as target for the image link.
    Please post the code of your image link.
    Timo

  • Calling a Control Flow Case

    Hello there, i have a task flow with 4 page fragments, and 3 Control Flow Cases, that basically does the navigation.
    Im calling the task flow from a view.jspx that has 2 frames, left and center, the task flow its located at the center frame, and on the left frame i have 4 navigation buttons on that corresponds to each page fragment.
    Now the problem is how can i bind my buttons to my Control Flow Cases of my Task Flow ???
    Edited by: ThDn on Jan 19, 2010 7:20 AM

    Hi,
    Without the use case, it's difficult, but the general idea is to have 4 task flows, one per menu item. Then, you add a single region to your page and change the task flow id in the page def for an EL expression. The EL expression has to point on a managed bean property that returns the right task flow id depending on the context. Finally, you have the menu items call the managed bean to activate the task flow id linked to the item clicked as the current task flow, thus displaying it in the region. That's the basic way to implement a region changing according to an action made in the container page. The Fusion develoepr guide has a more comprehensive and detailed explanation on dynamic regions.
    Regards,
    ~ Simon

  • Controll flow of logon par files

    Hi ,
    In portal we are using two std par files 1.com.sap.portal.runtime.logon_api. && 2.umelogonbase
    Can any one help ,How exactly the controll flow is happing here , when we type user name & password on logon screen.
    And what is the use of there two par files. What I want to do ,If i need to design an logon page with out these two par files...
    Any ways are there to achive this requirement... Pls help me out....
    Cheers
    Rabin D

    Rabin,
    There are numerous threads already on this topic -
    You need to customize only one file in the customer namespace : com.sap.portal.runtime.logon.par which internally uses umelogonbase.jar and  com.sap.portal.runtime.logon_api.jar.
    Go through the below links for SAP Logon customization - This would make it easy !
    Portal Customizations Intro - Login Part 1 - > Portal Customizations Intro - Login Part 1
    Portal Customizations Intro - Login Part 2 - > Portal Customizations Intro - Login Part 2
    Customizing Portal Logon Screen
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/23/c0e240beb0702ae10000000a155106/frameset.htm
    A fast and easy Portal logon page customizing
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/371e9d90-0201-0010-c39c-fd2956154ab3
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a000df6b-586a-2910-e6be-9fee831d5a30
    ~ Dhanz

  • Why do we require Wildcard control flow rule?

    Hi,
    Why do we require wildcard control flow rule?
    Can anyone please explain me with a scenario?
    Thank you,
    Srinivas

    Wildcard rule means the rule is valid on all the taskflow's pages, so you don't have to wire the case separately from each page. Handy if you have for instance a button with a common action on many pages.
    See this example: http://blogs.oracle.com/jdev11g/2009/10/wildcard_control_flows_for_page_navigation.html

Maybe you are looking for

  • Importing Contact Persons through DTW

    Hi, I´am trying to import Contact Persons through DTW. These "Contact Persons" belong to Business Partners that already have "Contact Persons". I want to add new contact persons to these Business Partners. The problem that instead of adding those Con

  • GR without PO (501) using own price instead of M.Master Rec's price.

    Hi all, I have the following business process issue which I urgently need your help: Background: Currently our company will perform buying from another subsidiary (another plant in another company code) from a buying price offer by them and this proc

  • The report server service is not running on Reporting Service Point server

    Hi, I have encountered a problem, my reporting service point has stopped working. (SCCM 2012 R2) In srsrp.log: Check state SMS_SRS_REPORTING_POINT 12/15/2014 5:48:54 AM 3152 (0x0C50) Check server health. SMS_SRS_REPORTING_POINT 12/15/2014 5:48:54 AM

  • Notification log file

    Hi ebs r12 12.1.1 Problem: Workflow Notification Mailer stop every 3 or 4 hrs. ran "Purge Logs and Closed System Alerts" on date=05/26/2010 FND_LOG_MESSAGES table Workflow Notification Mailer After ran the concurrent and check the tables, most of the

  • Desktop Tools Update  2.04.2

    Today I became the DPS Desktop Tools Update to v2.04.2 for CS6 via the Application Manager. Is there a description about the fixes in this update? Thanks Haeme Ulrich