Dynamic Sub Url

Hi Guys,
I need to handle the sub-urls dynamically. For example, I have three entries in database table. aaa, bbb, ccc; to represent different divisions of the web-application. How can I manage three urls for each division like below.
www.hostname.com/aaa
www.hostname.com/bbb
www.hostname.com/ccc
Regards,
Kashif

Place a webapp in the context root and let a servlet or filter listen on the root.
Or -if the appserver supports it- use virtual hosts. Refer its documentation for details.

Similar Messages

  • Use of SOAP Receiver Adapter in a recursive way with dynamic Target URLs

    Hi all,
    I have a following scenario.
    1. I have to call a webservice with a URL http://myserver.com/default.aspx?action=index
    This will return a list of xml filenames as below
    <?xml version="1.0" encoding="UTF-8"?>
    <filelist>
      <file uuid="test1" />
      <file uuid="test2" />
      <file uuid="test3" />
      <file uuid="test4" />
    </filelist>
    2. Now I have to call the same webservice with a change in action so that the url looks like
    URL - http://myserver.com/default.aspx?action=fetch&uuid=
    for all the filenames in the list
    So in essence, I have to create a dynamic URLs recursively like
    http://myserver.com/default.aspx?action=fetch&uuid=test1
    http://myserver.com/default.aspx?action=fetch&uuid=test2 and so on
    3. And with each call to the URL in step 2, the incoming xml is to be mapped to an IDoc.
    I will be creating a ABAP proxy to initiate the calls.
    I would like some ideas so as to have a less complex approach to the solution.
    Regards,
    Neeraj

    Hi,
    dynamic SOAP URL - adapter specific properties (http receiver adapter)
    Dynamic configuration payload - https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/com/sap/aii/mapping/api/DynamicConfiguration.html
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get
    (StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","THeaderSOAPACTION");
    String a = http://something.abcd/applicationName/xmlMessage //set the value of actual action here
    conf.put(key, a);
    return "";

  • SOAP adapter and dynamic target URL

    My scenario: synchronous communication ABAP Proxy <=> XI <=> External WebServices.
    There is a need to have configurable (dynamic) target URL for SOAP Adapter. This target should be configurable from ABAP Proxy. Any idea how can I achieve my goal?
    Some additional notes why I need configurable target URL. I've multiple WebService instances which has identical interfaces and the only difference is target URL. I see no need to define for each webservice different SOAP Adapter. The other thing is that customer want to have configuration of destination (target) url on backend system (where ABAP Proxy is used).

    Check http://help.sap.com/saphelp_nw70/helpdata/EN/29/5bd93f130f9215e10000000a155106/frameset.htm
    It's possible to set the URL for Soap dynamically.
    To process adapter attributes in the message header of the XI message, set the Use Adapter-Specific Message Attributes indicator and the Variable Transport Binding indicator.
    You can evaluate the following attributes in the message header:
    Description: You can set the entire URL.
    Technical name: TServerLocation

  • How to get Dynamic Converter URL

    Hi all
    I need to get dynamic converter url of document like http://<localhost>:<port>/cs/idcplg?IdcService=GET_DYNAMIC_CONVERSION&dID=7411.
    I use DOC_INFO_BY_NAME and i can find document url using 'DocUrl'. But i cannot find anything about dynamic converter.
    How can i get the url just using RIDC?
    Best Regards
    Qian

    Hi ,
    Whether i can get which format will be converted(convert format in Dynamic Converter Admin Configuration Setting) ?
    This is applicable for the UI alone where in all the formats that you want to have "HTML" option shown will be added from the above option .
    As for getting Dynamic Conversion using the IdcService , all of the contents can be used irrespective of whether they are added in the DC Admin section or not . So if you want to show the HTML format then all you need to do is to call the GET_DYNAMIC_CONVERSION service and pass the dID of the respective contents .
    Thanks,
    Srinath

  • HELP troubles with dynamically generated URLs

    I'm trying to integrate a new shopping cart, but DW CS4 can't follow the dynamic links in the template pages. They render fine in Live View. I can follow the CSS in the CSS Styles panel, but of course, it's not editable. Related files are far from complete and if I try to click on one, I get an error that the file can't be found.
    The templates all contain dynamically generated URLs such as:
    <?php include("${__TPL_DIR__}pages/templates/part.header.tpl.html"); ?>
    The .ini files used have site root relative references.
    Any ideas? Or am I stuck limping along?

    Thanks David,
    I found a few articles in the Developer Center that were helpful in understanding what I was looking at. The articles on creating Drupal and Wordpress themes explained how the pages are created dynamically, as well as how to use DW to modify and create themes. Though the specifics are different than what I am looking at, the concepts are similar. They also confirmed that attaching the relevant CSS files as design time style sheets was a practical workaround in the absence of an add-on to help DW understand the site structure. I was hoping that I had just not done something correctly, but I can live with a workaround, knowing that an "easier" way isn't just waiting for me to learn something about DW.
    Don

  • How to protect URL with OSSO while leaving sub-URL unprotected

    Hi,
    I have deployed an application to OAS while SSO is enabled and I have the following URL to be protected:
    http://host:port/myContext
    In the myContext application, there is a servlet that I want to be unprotected:
    http://host:port/myContext/myPublic
    I tried two ways to achieve this. One is in mod_osso.conf, create a Location entry like:
    <Location /myContext/>
         require valid-user
         AuthType Basic
    Order deny, allow
         Allow from myPublic
         Satisfy any
    </Location>
    The other way is to create a LocationMatch in mod_osso, like:
    <LocationMatch ^/myContext((?!myPublic).)*$>
    require valid-user
    AuthType Basic
    </LocationMatch>
    The problems with both of these two methods are they seem to break the HTTP server or show down the whole server. I would like to get help on this:
    1. What is the legitimate way to do this: protect a URL while unprotect its sub-page.
    2. In order to protect a new URL, besides adding a Location or LocationMatch , is there something else to do? I don't know why the new entries break/slow down the server.
    Thanks for any help.

    Hi,
    Please refer to this message:
    Re: How to deal with SSO secured webservices
    I tested the described approach and it worked fine for me.
    Best regards,
    IG

  • Dynamic sub-topic slide counter in Captivate 7

    Hi, I was wondering if anyone could give me guidance on the following routine that i would like to implement using Captivate 7.
    I would like a front-end menu selector slide to dynamically count how many slides are allocated to each of the sub-topics so that it can 'show' when all slides have been completed topic by topic.
    I envisage puting a pre-loaded topic selector onto my master slide, so that when you load a new slide into the filmstrip, you would choose from a 'dropdown' as to which topic this slide belongs (this dropdown would not be visible in runtime)
    This way, when i enter the package in runtime, I can use the system variable to count how many slide are in the total package, but when i get to the menu slide, it will have dynamically counted how many slides are alloctaed to each topic before i enter the topics. Once the total amount of slides allocated to a topic have been completed, the menu button will indicate this.
    It is the sub-topic dynamic counting part of this query that i am having trouble with.
    Thank you in advance for any assitance you can provide on this matter.
    Craig

    Hi Lilybiri,
    OK, Captivate has a system variable that calculates how many slides are in a total package, but, for example, my package is broken down into sub-topics of:
    Colours
    Animals,
    Cars
    Flowers
    etc ....
    When I am developing the content and I add a new slide from my Master template, there will be a dropdown menu (not visible in runtime) from which I select which topic this new slide belongs to (ie Colours, Animals, etc ......). So I can do this for all new slides added to my package. (Probably a variable set for each slide which will be 'Slidetopic = Colours' or 'Slidetopic = Cars')
    When I finally run the package, I will have a 'Menu' slide where I can choose which sub-topic I want to visit, but I wan Captivate to dynamically count how many slides are there allocated to 'Colours', how many are set to 'Animals', etc, etc .....
    This way I can then determine exactly when I have completed the 'Cars' topic and change the menu button to indicate this fact.
    Upon initial entry, I would suspect my menu screen will display information such as:
    Total slides  = 40
    Colours = 12 slides
    Animals = 8 slides
    Cars = 14 slides
    Flowers = 6 slides
    It is the dynamic counting of the sub-topic quantity where I am hoping that someone may help me.
    Does this make my ambitions any clearer Lilybiri ?
    Thank you for your interest.
    Best wishes,
    Craig

  • Dynamic JDBC URls at Runtime

    Hi Experts,
    I did my application in jdev 11.1.1.6 and deployed using Jdbc Url connections and it worked successfully (Actually I m working with 2 diff Database connectiosn in my application)
    But the thing is my company need me to do something like I should be able to dynamically use Jdbc url connections at runtime so that they want to have QA db and PROD db inside the application
    and dynamically change them itseems. (i.e I will have 4 Db in which 2 for QA and 2 for PROD)
    Is there a way where I can achieve them. If so help me out.
    Thanks,
    933601

    Hi,
    You could store the database URLs in a properties file in the app server filesystem, then look them up in the dynamic JDBC code before setting the session attributes. So your QA app server has a properties file containing the URLs for the 2 QA databases and the PROD app server has a properties file containing the URLs for the 2 PROD databases.
    If you want a single app server to talk to multiple sets of databases you could pass a parameter to the login screen. Based on this you decide which database(s) to connect to.
    Kevin

  • Dynamic Configuration URL

    Hello,
    We had a working solution for dynamic URL settings for HTTP adapter from the message mapping using UDF as mentioned in the previous blogs and help.sap. But after a recent update of support packs the URL seems to be getting incorrect values. Is there any visial admin settings that need to be checked after SP upgrades with respect to dynamic URL configuration?
    Teresa

    Hi,
    I have tested the interface mapping and Message mapping. They seem to bring in the correct URL dynamically but during runtime its been sent to another URL.
    Please advise.
    Teresa

  • How to make dynamic provider-url for MDB.

    Hi,
              My application has an MDB that need to bind to a remote queue. The .bindigs file is created and put in a specified location. Is there any way I can specify a dynamic value for this location in the <provider-url> tag in my weblogic-ejb.xml file. This is because, in our UNIX test and prod servers, the location of the .bindings file different from what I have on my local box. I have tried like this, but it did not work.
              <provider-url>file:/%DOMAIN_DIR%/config/<provider-url>
              We always have a 'config' directory under the domain and if the domain name changes in different environments, i don't have to make any changes to my descriptor file.
              Thanks,
              Rajeev

    I met a similar problem when I used the foreign JMS server. I configured the foreign server via console. I tried to subscribe a remote topic which was maintained by another WebLogic JMS server. When I built my MDB, I got the following exception. The remote JMS server name could not be resolved. Any suggection is appreciated.
              <Sep 19, 2005 6:11:56 PM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven E
              JB: SIGNIT is unable to connect to the JMS destination: jms/DCGSCatalogTopic. Th
              e Error was:
              [EJB:010196]'weblogic.jms.common.JMSException: Error creating session' Linked ex
              ception = 'weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
              r riicServer'
              weblogic.jms.common.JMSException: Error creating session
              at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
              8)
              at weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1038)
              at weblogic.jms.frontend.FESession.invoke(FESession.java:2552)
              at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.jav
              a:643)
              at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.ja
              va:179)
              at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:1860)
              at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:1691)
              at weblogic.jms.client.JMSSession.createSubscriber(JMSSession.java:1422)
              at weblogic.ejb20.internal.JMSConnectionPoller.setUpTopicSessions(JMSCon
              nectionPoller.java:1582)
              at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSCo
              nnectionPoller.java:2009)
              at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectio
              nPoller.java:1180)
              at weblogic.ejb20.internal.JMSConnectionPoller.startJMSConnectionPolling
              (JMSConnectionPoller.java:846)
              at weblogic.ejb20.deployer.MessageDrivenBeanPoolInfoImpl.start(MessageDr
              ivenBeanPoolInfoImpl.java:234)
              at weblogic.ejb20.deployer.EJBDeployer.deployMessageDrivenBeans(EJBDeplo
              yer.java:1660)
              at weblogic.ejb20.deployer.EJBDeployer.start(EJBDeployer.java:1488)
              at weblogic.ejb20.deployer.EJBModule.start(EJBModule.java:689)
              at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
              .java:2127)
              at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
              ner.java:2168)
              at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
              activateContainer(SlaveDeployer.java:2503)
              at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
              SlaveDeployer.java:2421)
              at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
              yer.java:2138)
              at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(S
              laveDeployer.java:2237)
              at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDepl
              oyer.java:2132)
              at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(S
              laveDeployer.java:2384)
              at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
              veDeployer.java:866)
              at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDepl
              oyer.java:594)
              at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
              loyer.java:508)
              at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
              dler.java:25)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
              Caused by: weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
              r riicServer
              at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
              Manager.java:330)
              at weblogic.jms.dispatcher.DispatcherManager.dispatcherFindOrCreate(Disp
              atcherManager.java:380)
              at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
              6)
              ... 29 more
              Caused by: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.S
              :riicServer' Resolved weblogic.jms; remaining name 'S:riicServer'
              at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
              NamingNode.java:897)
              at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.jav
              a:230)
              at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.j
              ava:154)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:18
              8)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
              6)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
              6)
              at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.j
              ava:256)
              at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:359)
              at javax.naming.InitialContext.lookup(InitialContext.java:347)
              at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
              Manager.java:314)
              ... 31 more
              >
              <Sep 19, 2005 6:12:06 PM EDT> <Warning> <EJB> <BEA-010096> <The Message-Driven E
              JB: SIGNIT is unable to connect to the JMS destination: jms/DCGSCatalogTopic. Co
              nnection failed after 2 attempts. The MDB will attempt to reconnect every 10 sec
              onds. This log message will repeat every 600 seconds until the condition clears.
              >
              <Sep 19, 2005 6:12:06 PM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven E
              JB: SIGNIT is unable to connect to the JMS destination: jms/DCGSCatalogTopic. Th
              e Error was:
              [EJB:010196]'weblogic.jms.common.JMSException: Error creating session' Linked ex
              ception = 'weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
              r riicServer'
              weblogic.jms.common.JMSException: Error creating session
              at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
              8)
              at weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1038)
              at weblogic.jms.frontend.FESession.invoke(FESession.java:2552)
              at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.jav
              a:643)
              at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.ja
              va:179)
              at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:1860)
              at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:1691)
              at weblogic.jms.client.JMSSession.createSubscriber(JMSSession.java:1422)
              at weblogic.ejb20.internal.JMSConnectionPoller.setUpTopicSessions(JMSCon
              nectionPoller.java:1582)
              at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSCo
              nnectionPoller.java:2009)
              at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectio
              nPoller.java:1180)
              at weblogic.ejb20.internal.JMSConnectionPoller.trigger(JMSConnectionPoll
              er.java:978)
              at weblogic.time.common.internal.ScheduledTrigger.run(ScheduledTrigger.j
              ava:243)
              at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
              dSubject.java:321)
              at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
              121)
              at weblogic.time.common.internal.ScheduledTrigger.executeLocally(Schedul
              edTrigger.java:229)
              at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigg
              er.java:223)
              at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:5
              0)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
              Caused by: weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
              r riicServer
              at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
              Manager.java:330)
              at weblogic.jms.dispatcher.DispatcherManager.dispatcherFindOrCreate(Disp
              atcherManager.java:380)
              at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
              6)
              ... 19 more
              Caused by: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.S
              :riicServer' Resolved weblogic.jms; remaining name 'S:riicServer'
              at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
              NamingNode.java:897)
              at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.jav
              a:230)
              at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.j
              ava:154)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:18
              8)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
              6)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
              6)
              at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.j
              ava:256)
              at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:359)
              at javax.naming.InitialContext.lookup(InitialContext.java:347)
              at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
              Manager.java:314)
              ... 21 more
              >

  • Dynamic WSDL URL

    Hello,
    Does anyone know how to set the WSDL URL on an Xcelsius web connection from code or using a flash variable? I have a situation where the dashboard is shipped to multiple self-contained web sites and the WSDL needs to be hosted locally on each.
    Regards,
    Gilbert

    Hi Gilbert,
    just for my general understanding.
    If the same WSDL comes from different server and from each server the WSDL-definition is equal, you just need to create the mapping once with one WSDL. At runtime you can change to Web-Service URL dynamically then.
    From my understanding this should work.
    Dynamically loading new WSDLs with different definitions and accordingly creating different excel-mappings/data bindings for each WSDL at runtime won't work.
    Although dynamic data binding would be a nice and probably necessary feature.
    Regards,
    Roman

  • Dynamic Image - url

    Hi there,
    I'm working with 5.6.1 version and using the following way of parameter for a dynamic image it seems to work : alternative text url:{IS_GIS} where IS_GIS is a variable coming by an sql script, here the url http://www.affecto.lt/gfx/it_group_logo.gif.
    If I'm trying out with the 10.1.3.3.3 version it won't work....
    thanks
    Gian

    Hi Gian
    Are you getting an error or just no image, is the URL outside of a firewall?
    I assume 5.6.1 version is under an Application e.g. EBS, PeopleSoft?
    With 10.1.3.3.3 you are under the standalone release? If so, are you setting a proxy server upon startup to get to the image location?
    Can you post an XML snippet and the RTF field contents?
    thanks
    Tim

  • WSSecurity on Dynamic EndpointReference URL in BPEL

    BPEL version 1.1
    SOA Suite 11.1.1.6
    AIA 3.0
    I am trying to invoke R12 SOA gateway service using dynamic endpoint reference within my bpel code. <binding.*location*> in composite.xml is removed. I am constructing ws-security header xml inside bpel and assigning it to the invoke activity using bpelx:inputHeaderVariable. In this scenario, the invocation fails saying 'User is not authorised'. In R12 front end, I could see that user is going as null.
    But, when the location attribute of <binding> is assigned with the actual URL, then everything is working fine. Even from soap-ui, it works fine.
    Only when using dynamic endpoint reference, the ws-security is not getting set. I have tried using ws-security policies also, but getting the same exception.
    Any help please.
    Thanks,
    - KSH.
    Edited by: 840696 on Jan 11, 2013 5:13 AM
    Edited by: 840696 on Jan 11, 2013 5:25 AM

    This issue got fixed when we removed the string ?wsdl from the http wsdl url. I am not sure how it made a difference, if anyone knows please provide your inputs.
    Sample WSDL URL that was not working: http://9.9.9.9:999/abcd/xyz/?wsdl
    WSDL URL that worked: http://9.9.9.9:999/abcd/xyz/
    Thanks,
    - KSH
    Edited by: 840696 on Jan 19, 2013 5:52 PM
    Edited by: 840696 on Jan 19, 2013 5:52 PM

  • Dynamic Image Url html view

    Hi all,
    I am currentyl trying to display an image, which can be accessed by a http-url refering to an external server.
    The problem is, that that the displayed image is linked with the content...that means, that the image url has to be dynamic.
    Does anybody know how to solve this problem. I am currently mapping an url to the url-input of the html-view, but by starting the application the following error occurs:
    com.sap.tc.wd4vc.intapi.info.exception.WD4VCRuntimeException: No parser configuration entry for the tag HtmlView
    Does anybody know how to solve this problem?
    Thank you in advance.
    Kind regards, Patrick

    Hi Patrick,
    Are you still looking for the answer?
    Did you try the expression editor of the image control, where based on expression (ie., your content), image will be displayed.
    Are you storing the data (from where you pass the content to next UI component or next screen) in a data store; and taking the data store value in the expression editor of the image component?
    Let me know if it helps
    Regards,
    Vani

  • Making MySQL ORDER BY link dynamic in URL

    I would like to have a dynamic table sorted by a dynamic URL.
    I have found this script but I am not sure where I am meant
    to put the DECLARE?
    This is the MySql recordset:
    BEGIN
    DECLARE @SortOrder tinyint
    SET @SortOrder = 2
    SELECT *
    FROM products
    WHERE `Section` = colname OR `Department` = colname2
    ORDER BY CASE WHEN @SortOrder = 1 THEN Code
    WHEN @SortOrder = 2 THEN Name
    ELSE Order
    END
    I get an error saying this:
    You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to
    use near 'DECLARE @SortOrder tinyint SET @SortOrder = 2 SELECT *
    FROM products WHERE `Sec' at line 2
    Any ideas? And in the script what does the number 2 in this [
    SET @SortOrder = 2 ] refer to? Two CASES?

    I don't know for sure, but one thing I see is that you are using an alias which has the same name as the column:
    DATE_FORMAT(date_created, '%m/%d/%Y %l:%i %p') AS 'date_created',
    Then the order by clause is using that same column/alias. Maybe this is confusing MySQL?  If MySQL supports alias's based on functions in the order by clause, you might want to change that alias name to something else, like date_created_alias and use that in the order by.
    Otherwise, try using the complete function in the order by clause:
    ORDER BY DATE_FORMAT(date_created, '%m/%d/%Y %l:%i %p')  DESC
    But in any case, it sure seems like it should be sorting correctly the way you are currently handling it.

Maybe you are looking for