Set query string programmatically

Is there a way to set the query string of a report programmatically at runtime? Something like clientDoc.setQueryString( query ).
Thanks

Well, it's not too complex to do it with java... here is a simple example:
public class QueryStringChanger
     public static String changeParameter(String query, String key, String value)
          String[] keyValuePairs = query.split("&");
          StringBuffer newQuery = new StringBuffer();
          for (int k = 0; k < keyValuePairs.length; k++)
               if (keyValuePairs[k].indexOf(key) != -1)
                    String[] thePair = keyValuePairs[k].split("=");
                    keyValuePairs[k] = thePair[0] + "=" + value;
               if (k != 0) newQuery.append("&");
               newQuery.append(keyValuePairs[k]);
          return newQuery.toString();
     public static void main(String[] args)
          if (args.length != 3)
            System.out.println("Syntax: java QueryStringChanger 'the query string' theKey theValue\n"+
                               "Example: java QueryStringChanger page=1&area=3&title=Not+So+Good title Pretty+Darn+Good");
            System.exit(1);
          System.out.println(changeParameter(args[0], args[1], args[2]));
          System.exit(0);
}Not so sure what you would gain from a HashTable though...

Similar Messages

  • Set Query String Parameter

    What I am trying to do is to check whether does that variable exist in the querystring, if it does change the value to another value.
    How am I suppose to do abt doing that?

    Well, it's not too complex to do it with java... here is a simple example:
    public class QueryStringChanger
         public static String changeParameter(String query, String key, String value)
              String[] keyValuePairs = query.split("&");
              StringBuffer newQuery = new StringBuffer();
              for (int k = 0; k < keyValuePairs.length; k++)
                   if (keyValuePairs[k].indexOf(key) != -1)
                        String[] thePair = keyValuePairs[k].split("=");
                        keyValuePairs[k] = thePair[0] + "=" + value;
                   if (k != 0) newQuery.append("&");
                   newQuery.append(keyValuePairs[k]);
              return newQuery.toString();
         public static void main(String[] args)
              if (args.length != 3)
                System.out.println("Syntax: java QueryStringChanger 'the query string' theKey theValue\n"+
                                   "Example: java QueryStringChanger page=1&area=3&title=Not+So+Good title Pretty+Darn+Good");
                System.exit(1);
              System.out.println(changeParameter(args[0], args[1], args[2]));
              System.exit(0);
    }Not so sure what you would gain from a HashTable though...

  • Programmatically setting SQL Query string?

    Post Author: JoeM
    CA Forum: Data Connectivity and SQL
    Hi,
    I recently updated to Crystal Reports 11 from 8.5 and am having some problems getting my reports to properly function.  I need to set the SQL query string in the report at runtime in our C++ based program when the user selects what report they want to print.  So to do this I first open the report and connect to our database and that works fine, here is the code for that - 
    pReport = pCRPApp->OpenReport(TmplFName, dummy) ;
    pReport ->Database->LogOnServer("crdb_odbc.dll", ODBC_FILEDSN, DatabaseName, DatabaseUsrNm, DatabasePwd);
    but when I use PutSQLQueryString to set the custom sql query that I've made it does not appear to work because when I use GetSQLQueryString right after that, the returned string is not the one I just set. Here is the code for that part -
    pReport->PutSQLQueryString(SQLExprBuf);
    sprintf(TestSQL, pReport->PutSQLQueryString());
    TestSQL is not the same as SQLExprBuf
    So my question is how do I properly set the SQL query string programmatically, is there some setting in my report that needs to be turned on or am I using the wrong function?  I read somewhere that you can use the Add command option in the report to set the query string as well, is there a way to programmatically do that?

    In Access create a View showing the information you want, then in design mode click View, SQL to see teh SQL you need. now make sure the SQL you build in VBA is exactly the same. so in the Immediate window type a ? then copy paste your code then press Enter
    to see the result, EG:
    ?"UPDATE Lan_landmeter " _
            & "SET OpleidingsBedrijf =" & bedrijf & " ,Opleiding_startdatum =#" & startdatum & "#,Opleiding_einddatum =#" & einddatum & "#,Aantal_opleidingsuren_vast=20,Aantal_gevolgde_uren
    =" & gevolgde_uren & ",Aantal_resterende_uren=0" _
            & "WHERE  Id_landmeter =" & naam & ""
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Set whole Query string to null or ""

    Good morning!
    Is there a way to set the whole query string to null or ""?
    so that request.getQueryString() = "" ?
    I've been trying something like this
    String body = "";
    request.setAttribute(???, body);
    what would go in the ???
    thanks,
    Alex

    Thats not good. I'm having a problem when the session times out. When a person times out , the system forwards them to the login screen. When they login, they are authenticated by siteminder and the last action they requested is sent (whatever is in the querystring) The querystring tries to go to our controllerservlet (in the querystring), and bypasses the login servlet! I figured if you set toe querystring to "", it would have to go to the loginservlet

  • Explicitly setting the query string in http get request

    Hi All,
    We are trying to use the query string parameter to send a GET request to a vendor. The parameter value is a string concatenated with xml ie. String=<xml></xml> It seems the vendor is reading this value as string and Looking for "<XML>" to strip out the values. The problem in OSB is when I concatenate the fn:concat("String=",<XML/>) the acutal value is translated to "String=&lt;XML/>. Is there a way to explicitly set the value so the < doesn't get encoded to &lt; ? the odd thing is that only the left less than bracket get encoded. Any help would be most appreciated...
    thanks,
    Matt
    version of OSB:
    Service Bus 10gR3
    Oracle Service Bus Version: [WebLogic Oracle Service Bus 10.3 Sat May 30 06:12:38 EDT 2009 1223943 ]
    Oracle Weblogic Server Version: [WebLogic Server 10.3 Fri Jul 25 16:30:05 EDT 2008 1137967 ]

    The left side bracket is actually getting encode as amplt; (this forum encoded it :))

  • Setting SharePoint 2010 Form Fields Using Query String Variables

    Hi All,
    I have a requirement to populate sharepoint form field value with query string while uploading document to document library.
    While uploading the document to document library, I want to populate claim number available from query string in a pop up page i.e in my case EditForm.aspx, Located at
    http://servername:port/sitename/documentlibraryname/forms/EditForm.aspx.
    Additional Information:
    Created document library and added custom columns like claim number etc..
    Created a view to filter uploaded documents as per claim number.
    Server Details:
    Windows Server 2008 R2
    SharePoint 2010
    SQL Server 2008 R2
    I have written javascript for the same, but not sure where exactly to add the code in EditForm.aspx page.
    Any help on this would be greatly appreciated.
    Thanking you in advacne.
    Regards
    Seva

    if the NewForm.aspx contain a "New Item Form" or "Edit Item Form" you can populate the form field by doing the following:
    First for the data view create a parameter from query string and give it the claim_number query string name.
    now for the field Claim Number Convert it to normal ASP.NET TextBox example below for this
    Normal Field will be like this
    <SharePoint:formfield runat="server" id="ff5{$Pos}" ControlMode="Edit" FieldName="ClaimNumber" ItemId="{@ID}" __designer:bind="{ddwrt:DataBind('u',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ClaimNumber')}" />
    you will change it to
    <asp:TextBox runat="server" id="ff5{$Pos}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ClaimNumber')}" />
    Now in the asp:TextBox you can add the "Text" Attribute and assign the created data view parameter to it example below
    <asp:TextBox runat="server" id="ff5{$Pos}" Text="{$Claim_Number}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ClaimNumber')}" />
    Where {$Claim_Number} is your Query String Parameter.
    Now if you send the query string NewForm.aspx?Claim_Number=1232
    you should see the field populated
    This what I do usually to populate the fields
    How I Bought a Brand New $1.2 Million Home Using ONLY Affiliate Commissions
    I'm having the same problem.... allmost
    I have a querystring I wan't to parse into a form. But on editform, not newform. then the field gets populated, but on save, nothing happens.... It's just blank.... any ideas.?
    /Ulrich

  • How do I add a record's primary key to a query string and add that to an .xml catalog?

    Hello everyone,
    I am using Dreamweaver CS3 on a MacBook Pro Leopard 10.5.6 and MAMP 1.7. I am also teaching myself how to work with PHP and MySQL, using David Powers book The Essential Guide to Dreamweaver CS3.
    I am trying to create a wedding photography web site, with a personal page after login, which will display the photographs of the customers wedding.
    The same page will also be a catalog/shopping cart, so the customer can choose which photo's they want, and pay for them. (I am aware that there are instructions in The Essential Guide in chapter 15 page 515, on how to redirect to a personal page, but it doesn't fully cover what I am asking).
    I have already created the login success page, which greets users by name, as per the instructions in The Essential Guide. I have also created a catalog page. However my catalog page is not calling information from the database, instead it is taking information from an XML page using PHP.
    I would like to insert a list menu on the login success page, which lists the customers name, and when they select their name they will then select a link that will take them to a personal page with just their wedding photographs.
    I am unsure of how to pass the customer_id, in what will be the username list menu, to the page which will contain the customers set of wedding images.
    Is it the same process used in chapter 14 where you add a record's primary key to a query string?
    I am asking because when I set up a recordset from the MySQL database it lists the images as witten names not actual images, I have tried calling the images with PHP code but it just doesn't work.
    The catalog page I have set up at the moment is not calling the images from the database, but directly from the image folder.
    Is what I am trying to do possible?
    If so how do I pass the customer_id and username to a recordset and link that recordset to the xml catalog so the customers personal wedding images are displayed on the catalog page for the shopping cart?  I need step by step instructions, or maybe a link to a good tutorial.
    Can somebody help me please?
    Thankyou.

    QuickTime 7 can set the poster frame, but I've not had much success with it. This is what QuickTime 7 Help says about this topic:
    +A "poster frame" is a still image of a movie that represents the movie in places like the Finder. The default poster frame is the first frame in the movie. You can change the poster frame.+
    +To change a movie's poster frame:+
    +In QuickTime Player 7, drag the playhead (or use the arrow keys to move the playhead) to the desired frame.+
    +Choose View > Set Poster Frame.+
    +To view a movie's poster frame, choose View > "Go to Poster Frame."+
    If you don't have QuickTime 7 (version 7.6.6) it can be installed from your Snow Leopard disc using a custom install. Otherwise download it from this Apple site: http://support.apple.com/kb/DL923
    John

  • How to get the original query string in an event receiver when dialogs are enabled

    I have scenario where I am adding a document to a document library which has an external data column on it. My goal for this column is to have it automatically populated with an appropriate value based on original query string to the page. The general
    idea is that I am on a custom page that has various webparts on it including a view of my document library that is context sensative based on the query string, and I want to use that context sensitivity not just to filter the list but also when adding documents.
    I have been searching around for solutions to this problem all day and have gotten this far:
    I have an event receiver attached to my document library that handles the ItemAdded event syncronously (as such I have the new list item available to me). In that event receiver I am able to set the column values as required. Where I am stuck is on getting
    the value from the query string that I need to actually set as the column value.
    Based on:
    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/8cfcb299-9a55-4139-86ec-0b53b2922a54 and several similar articles/posts I have been able to get the original source Url with the query string I want via the following
    code in my event receiver:
    private HttpContext context;
    public EventReceiver1()
    context = HttpContext.Current;
    public override void ItemAdded(SPItemEventProperties properties)
    var originalQueryString = context.Request.QueryString["Source"];
    // Parse the query string and use the value ...
    The problem is that this solution breaks down if the dialogs are turned on under the advanced settings for the list. The reason the solution fails is because the "Source" query string parameter goes away and is replaced by "IsDlg" set to a value of "1".
    Does anyone know how to get past this hurdle? Any help would be greatly appreciated.

    Hi Stuart,
    The reason I'm looking for "Source" in the query string is because that is something I found to be reliable when the Dialogs are turned off. I've dug around pretty deep in the Request object to see if anything had the data I was looking for and unfortunately
    it doesn't appear to be there. The
    context.Request.QUeryString.ToString()
    returns a rather simple one of:
    List=%7b43ECDCB0-8440-4652-B067-AA20481779D7%7d&RootFolder=&IsDlg=1
    and the
    context.Request.UrlReferrer.Query.ToString()
    has the same value.
    I suspect this is due to the dual step process that takes place in adding an item to a document library where the first modal popup (which I suspect likely has the information I need) gives you the opportunity to browse to your file and then the second
    dialog (maybe this is getting brought up as a result of another request which is now referring back to the original request that brought up the first dialog?) where you edit your properties.
    Thanks for the try though, if you've got anything else I'd love to hear it.

  • Dynamic Interface in Query String does not work?

    Hi All,
    i have exposed a interface as a webservice with the help of the Define Web Service in Configuration Builder.
    In the SOAP Sender Communication Channel i have checked the options Use Encoded Headers and Use Query String
    The url of the webservice looks like this:
    http://server:50000/XISOAPAdapter/MessageServlet?channel=:BS:CC_SOAP_SENDER&version=3.0&Sender.Service=BS&Interface=http%3A%2F%2Fnamespace.com%2Fabc%2HER%2FGlobal%5EMIOS_GetDetails
    This works which is great, i can now retrieve supplier details with this webservice. Now i want to expose another interface as a webservice. That URL looks like this:
    http://server:50000/XISOAPAdapter/MessageServlet?channel=:BS:CC_SOAP_SENDER&version=3.0&Sender.Service=BS&Interface=http%3A%2F%2Fnamespace.com%2Fabc%2HER%2FGlobal%5EMIOS_EventBooking
    As you can see i have a different interface in the URL's of the Webservices. I want to have both make use of the same Communication Channel which is possible according to [SAP Note 856597|https://websmp130.sap-ag.de/sap(bD1ubCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=856597] See Q: Can I set the interface name dynamically from the client? also in this document : [How to Use the XI 3.0 Soap Adapter|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79]
    The problem is that when i try to call the second web service (EventBooking) that is routes to the mapping of the GetDetails interface, i can see this in SXMB_MONI. Therefore it gives an Error.
    When i try both scenarios in Configuration Builder they both work fine, only the webservice call of EventBooking ends up in the Message Mapping of GetDetail.... Why? And how to solve this?
    Anyone have experience with the feature mentioned in the SAP note?

    After some further examination it seems that both calls are picked up by the same interface. In the RWB both the messages are picked up by the MIOS_GetDetails...
    How can i fix this?

  • How to manage Locale info in the URL path, but not the query string

    We are building an application using Struts 1.1 and Tiles, on Oracle Application Server 10.1.3.3...
    I know this is a strange question... but we have a requirement to represent the locale info in the URL string using one of the following options:
    option 1: /eng/page.do?id=2 for english.../fra/page.do?id=2
    option 2: /page-eng.do?id=2 for english.... and /page-fra.do?id=2 for french
    We need to represent the 3 letter ISO lang code either in the directory structure, or suffix the page name (in our case, the struts action name)... we cannot replicate this using a parameter in the query string. I know this is odd, but that is what we are told to implement.
    Is there any robust way of implementing either option in Struts 1.1, JSP, JSTL etc...?
    Currently, we are looking at using a servlet filter to intercept the HTTP requests, parse the URL string, and extract the ISO lang value, and set locale and forward on the request.
    This poses a few problems... adding additional action mappings (page-eng... page-fra... page) to our struts-xml.config file to handle lang permuations... but the biggest issue is all the embedded html:link action values throughout our code...
    Because all our public facing URLs must comply with the rule, we need to change the html:link action to point to a different action, based on locale.
    Very inefficent, and I'm sure not industry standard best practice... we are using Tiles, and resource bundles for all our labels etc... but fall short in meeting this rule with regards to URLs and locale.
    Any advice or tips etc.. is greatly appreciated.

    The filter option sounds like a good solution. So it can receive the urls and parse them appropriately.
    You just need to take it one step further.
    Additional actionmappings in your struts-config should not be necessary.
    Filter:
    - analyses the url and sets the appropriate locale
    - adjusts the url such that the next level of the chain does not have to know anything about the locale being encoded in the url string.
    Thus your struts classes and mappings can remain unchanged
    /eng/page.do or /fra/page.do once through the filter should just look like /page.do to struts.
    That should get rid of half of your headache.
    Next the issue of generating urls.
    There are two approaches I can see here
    1 - use the filter approach again, this time with some post processing. Gather the generated HTML in a buffer, and do a find/replace on any urls generated, to put the locale encoding into them.
    2 - Customise struts to produce urls in this format. This would involve the html:link tag, and the html:form tag at the least (maybe others?). Get the source code for struts, and grab the html:link tag code. Extend that class to generate urls as you want them to be generated. I think you would need to extend the class org.apache.struts.taglib.html.LinkTag and override the protected method calculateURL. You would then have to edit/modify the struts-html tld to point the link tag at your classes rather than the standard ones.
    Option 1 is architecturally good because it gives you a well defined layer/border between having the locale encoded in the url, and not having it there. However it involves doing a find/replace on every html going out. This would catch all urls, whether generated by html:link tag or not.
    Option 2 requires customising struts for your own requirements, which may be a bit daunting, but has the advantage of generating the urls correctly without the extra overhead involved with option 1. Of course you would have to ensure that ALL urls are generated with the html:link tag.
    On reflection, I think option 1 is preferable, as both easier and quicker to implement, and doing a better separation in the architecture.
    Cheers,
    evnafets

  • How to build dynamic query strings in the query using DB adapter 'Pure SQL'

    Dear Forum,
    I am building an application which will access DB to fetch some result set. The query involves retrieving data from multiple tables(nearly 10 tables). So I have created a DB adapter using 'execute pure sql' option. With this query works fine, but my inputs parameters will vary. So I need to make my query dynamic to append the query strings at runtime depending on the inputs.
    For example I have 3 input variables - input1,input2 and input3 (in my request xsd) which are used in the pure sql query. Now if I get a 4th input parameter input4 in the request, I need to append this to query string as 'AND input4=[some value]' at runtime. Otherwise my query should have only 3 parameters. Please suggest how this can be achieved.
    Regards,
    Satya.

    This is a strange requirement, depending on the columns you have and what are optional in them, one way is to have separate operations and each opeartion will have different inputs and for each operation , a different DB Adapter is called. But this way, it results in more number of operations for the service as well as more number of references in the composite. Even if you pass the column inputs to the SQL procedure, it will result in a large number of if-else cases..
    Thanks,
    N

  • How can I use today's date as default value in query string filter web part in SharePoint

    I have a query string filter on my web part page. I am trying to figure out how I can set it's default value to Today? I can't find anything online...

    Hi,
    Per my understanding, you might want to set a default value to the Query String Filter Web Part.
    It would not be able to set default value to the Query String Filter Web Part with the OOTB features available.
    By default, with a Query String Filter Web Part in the current page, we can filter other web part in the same page by adding parameters and values in the address bar
    of browser.
    If setting the “Query String Parameter Name” of a Query String Filter Web Part as “t”, then we can filter the corresponding connected web part by inputting such an
    URL into the address bar:
    http://sharepoint/SitePages/Page1.aspx?t=value1
    Suppose you want to filter the list view with a value dynamically when user opens this page, as a workaround, we can generate an URL with the parameters needed when
    page loaded, then redirect user to this URL afterwards. This can be achieved using JavaScript.
    About how to redirect user to other page with an URL:
    http://www.tizag.com/javascriptT/javascriptredirect.php
    How to get today’s date using JavaScript:
    http://www.w3schools.com/js/js_dates.asp
    Best regards      
    Patrick Liang
    TechNet Community Support

  • Reverse proxy query strings

    Hi
    got a reversse proxy running but no url's are cache where a query string is in the url. gif,doc, pdf are cached ok. what the max value for query-maxlen? will it accept 2000?
    any other ideas to check and try. i can't see any log into to tell my why it not cachiiiing these requests.

    version 4.0 b 05/10/2005
    request url is /wcm001/idcplg?idcservice=SS_Get_page&nodeid=308
    URL DB cache /wcm001/idcplg
    User clicks on page tab and requests wcm001/idcplg?idcservice=SS_Get_page&nodeid=309&sssourcenodeid=308
    nothing happens, the home page i displayed agian.
    query_maxlen=2000. set it to 32 and no difference. HTML header traces show web browser did make a new request to the proxy server for the different query string

  • Query Strings in Request Dispatcher Paths (PLT.16.1.1)

    I'm having trouble using query strings in a request dispatcher include to a servlet.
    I'm spitting debug out, and it looks like I'm calling:
    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/myServlet?myparam=myparamValue");
    And myparam isn't being set for myServlet.
    The same URL ("http://myhost:myport/myPortal/myServlet?mayparam=mayparamValue)
    runs fine standalone....

    I'm not sure of the exact dates (either this month or the next). But
    JSR168 will be supported in the service pack.
    Subbu
    T-Bone said the following on 11/18/2003 09:23 AM:
    Subbu Allamaraju <[email protected]> wrote:
    There is a known bug in WLS's servlet container that results in this
    behavior. Please contact support if you need an expedited solution.Thanks, they said to wait for SP2 sometime end of November.
    Can you tell me when it will be available?
    Also, when will JSR-168 v1.0 be supported?
    Subbu
    T-Bone said the following on 10/26/2003 03:14 PM:
    I'm having trouble using query strings in a request dispatcher includeto a servlet.
    I'm spitting debug out, and it looks like I'm calling:
    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/myServlet?myparam=myparamValue");
    And myparam isn't being set for myServlet.
    The same URL ("http://myhost:myport/myPortal/myServlet?mayparam=mayparamValue)
    runs fine standalone....

  • How to retrieve query string value from the URL in my portlet

    Hi,
    When user clicks on "Advance Search", i am redirecting to page in the community. At the same i am adding some more values to the query string (to the URL).
    My URL will look like this.
    http://ctp-mc0149/portal/server.pt?space=CommunityPage&parentname=CommunityPage&parentid=0&in_hi_userid=200&cached=true&control=SetCommunity&PageID=202&CommunityID=200&searchType=2
    Now in one of my portlet in that page, i want to retrieve the query string values from the URL.
    Please help me regarding this.
    Thanks in advance.
    Thanks,
    sreekanth.

    Hi,
    Look at the following threads,
    For programmatically getting the iview properties,
    Programmatically getting iView Properties
    Also,
    Get Properties of IView Programmatically
    Permanent change of iView property programmatically
    Hope these threads help u.
    Regards
    Srinivasan T

Maybe you are looking for

  • Will I be able to create an app?

    Hello everyone, Before I get to my question, please bear with me for just a few lines, so that I can contextualize it. I'm a Mac user since 2006, and I'm pretty confortable with using the applications available. I'm a music producer, I work with Logi

  • TDS is not getting reversed in T.Code:  F-54 -Clear Vendor down payment

    Hi, Please help on the below issue:- 1. We passed one entry relating to down payment for fixed asset.  We deducted TDS also (50% down payment). 2. We passed MIRO also.  There we deducted TDS on full value of invoice amount. 3. While making T.Code:  F

  • Scan error 22 on HP Color LaserJet Pro MFP M176n

    I'm sorry, but I have a problem, and solution on this web-page didn't help me A 'Scanner Error 22' Message Displays on the Printer Control Panel.  Have you got any other solutions of this problem? Respectfully yours,Alexander.

  • IOS6 beta 2 downgrade to 5.1.1

    Hi, I have upgraded my iPad 3 with iOS 6 beta 2. How do I downgrade it back to 5.1? any ideas? Thanks

  • Change connection Pool according to dashoard prompt.

    Hi experts, I have a requirement where user will select the server name(Server1/Server2) from dashboard prompt and OBIEE should fire query on the respected server. Thanks,