Hi,
I'm using <xforms:repeat nodeset="instance('switches-instance')/ras_client"> <xxforms:variable name="switch" select="."/> <xhtml:tr> <xhtml:td><xhtml:center> <xforms:select appearance="full" ref="instance('selected')/selection"> <xforms:item> <xforms:label/> <xforms:value value="$switch/nas_identifier"/> </xforms:item> </xforms:select> </xhtml:center></xhtml:td> <xhtml:td> <xforms:output value="identifier"/> </xhtml:td> </xhtml:tr> ...... <xforms:trigger> <xforms:label>Query</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:send submission="query-switch-logs"/> <xforms:dispatch targetid="results" name="fr-toggle"/> </xforms:action> </xforms:trigger> ........ to provide the user with a table of items each with an associated checkbox. In this case its a list of IP addresses. and the resultant contents of ras_clients/ras_client can be one or more IP addresses delimited by a single space. e.g. <selections> <selection>a.b.c.d 1.2.3.4 etc </selection> When the user clicks on Query the instance is submitted to an xpl file that generates the results and the user is directed to another fr:tabview where the "output" instance is displayed. The sql statement is currently select INET_NTOA(nasip)as ip_address ,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId from eaplog where INET_NTOA(nasip)= substring_index(<sql:param type="xs:string" select="/selections/ selection"/>," ",1) and NOT ( userid like 'host%' and status='Success') order by DeviceReportedTime desc limit 200 Which works just fine if 1 checkbox in the <xforms:repeat> ... is selected. The substring_index function ensures that the user can select as many checkboxes as they want, they'll get output related to the 1st one. This is temporary. What I need to do is use a WHERE...IN (a,b,c...) construct in the sql statement e.g. WHERE INET_NTOA(nasip) IN ('a.b.c.d','1.2.3.4'...) Basically I need to replace start of string with a " (' " chars replace all spaces with " ',' " chars replace end of string with " ' )" chars which results in an sql statement of the form select INET_NTOA(nasip)as ip_address ,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId from eaplog where INET_NTOA(nasip) IN <sql:param type="xs:string" select="/selections/selection"/> and NOT ( userid like 'host%' and status='Success') order by DeviceReportedTime desc limit 200 It's all very simple if you can use regular expressions. Is there any way I can do this somewhere in xforms:trigger> <xforms:label>Query</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:send submission="query-switch-logs"/> <xforms:dispatch targetid="results" name="fr-toggle"/> </xforms:action> </xforms:trigger> before the submission statement? Rgds Alex ========== Time for another Macmillan Cancer Support event. This time its the 12 day Escape to Africa challenge View route at http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&msa=0&msid=203779866436035016780.00049e867720273b73c39&z=8 Please sponsor me at http://www.justgiving.com/Alex-Sharaz -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
You could do something like this. Use a bind to calculate the modified
value, something like: <xforms:bind ref="selection2" calculate="concat('(', replace(../selection, '\s+', ','), ')')"/> Then use "selection2" in your SQL instead of "selection". Anyway, something along these lines. -Erik On Thu, Jul 14, 2011 at 7:51 AM, alex sharaz <[hidden email]> wrote: > Hi, > > I'm using > > <xforms:repeat nodeset="instance('switches-instance')/ras_client"> > <xxforms:variable name="switch" select="."/> > <xhtml:tr> > <xhtml:td><xhtml:center> > <xforms:select appearance="full" > ref="instance('selected')/selection"> > <xforms:item> > <xforms:label/> > <xforms:value value="$switch/nas_identifier"/> > </xforms:item> > </xforms:select> > </xhtml:center></xhtml:td> > <xhtml:td> > <xforms:output value="identifier"/> > </xhtml:td> > </xhtml:tr> > > > ...... > <xforms:trigger> > <xforms:label>Query</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:send submission="query-switch-logs"/> > <xforms:dispatch targetid="results" name="fr-toggle"/> > </xforms:action> > </xforms:trigger> > ........ > > to provide the user with a table of items each with an associated checkbox. > In this case its a list of IP addresses. and the resultant contents of > ras_clients/ras_client can be one or more IP addresses delimited by a single > space. > e.g. > > <selections> > <selection>a.b.c.d 1.2.3.4 etc </selection> > > When the user clicks on Query the instance is submitted to an xpl file that > generates the results and the user is directed to another fr:tabview where > the "output" instance is displayed. > > The sql statement is currently > select INET_NTOA(nasip)as > ip_address,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId > from eaplog where INET_NTOA(nasip)= > substring_index(<sql:param type="xs:string" > select="/selections/selection"/>," ",1) and NOT ( userid like 'host%' and > status='Success') order by DeviceReportedTime desc limit 200 > > Which works just fine if 1 checkbox in the <xforms:repeat> ... is selected. > The substring_index function ensures that the user can select as many > checkboxes as they want, they'll get output related to the 1st one. This is > temporary. What I need to do is use a WHERE...IN (a,b,c...) construct in the > sql statement e.g. WHERE INET_NTOA(nasip) IN ('a.b.c.d','1.2.3.4'...) > > Basically I need to > replace start of string with a " (' " chars > replace all spaces with " ',' " chars > replace end of string with " ' )" chars > > which results in an sql statement of the form > > select INET_NTOA(nasip)as > ip_address,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId > from eaplog where INET_NTOA(nasip) IN > <sql:param type="xs:string" select="/selections/selection"/> and NOT ( > userid like 'host%' and status='Success') order by DeviceReportedTime desc > limit 200 > > > It's all very simple if you can use regular expressions. > > Is there any way I can do this somewhere in > > xforms:trigger> > <xforms:label>Query</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:send submission="query-switch-logs"/> > <xforms:dispatch targetid="results" name="fr-toggle"/> > </xforms:action> > </xforms:trigger> > > before the submission statement? > > Rgds > Alex > > > ========== > Time for another Macmillan Cancer Support event. This time its the 12 day > Escape to Africa challenge > > View route at > http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&msa=0&msid=203779866436035016780.00049e867720273b73c39&z=8 > > Please sponsor me at http://www.justgiving.com/Alex-Sharaz > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing > list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Magic!
Worked a treat., .... pone smal problem though. In my sql:param statement I have to define the type as xs:string ..... which puts quotes round The whole parameter. This means I get '("a.b.c.d","1.2.3.4")' omitting the type argument results in a complaint. Is there any other type setting I can use that'll stop the automatic quote insertion? Rgds Alex On 15 Jul 2011, at 03:44, Erik Bruchez wrote: > You could do something like this. Use a bind to calculate the modified > value, something like: > > <xforms:bind ref="selection2" calculate="concat('(', > replace(../selection, '\s+', ','), ')')"/> > > Then use "selection2" in your SQL instead of "selection". > > Anyway, something along these lines. > > -Erik > > On Thu, Jul 14, 2011 at 7:51 AM, alex sharaz <[hidden email]> wrote: >> Hi, >> >> I'm using >> >> <xforms:repeat nodeset="instance('switches-instance')/ras_client"> >> <xxforms:variable name="switch" select="."/> >> <xhtml:tr> >> <xhtml:td><xhtml:center> >> <xforms:select appearance="full" >> ref="instance('selected')/selection"> >> <xforms:item> >> <xforms:label/> >> <xforms:value value="$switch/nas_identifier"/> >> </xforms:item> >> </xforms:select> >> </xhtml:center></xhtml:td> >> <xhtml:td> >> <xforms:output value="identifier"/> >> </xhtml:td> >> </xhtml:tr> >> >> >> ...... >> <xforms:trigger> >> <xforms:label>Query</xforms:label> >> <xforms:action ev:event="DOMActivate"> >> <xforms:send submission="query-switch-logs"/> >> <xforms:dispatch targetid="results" name="fr-toggle"/> >> </xforms:action> >> </xforms:trigger> >> ........ >> >> to provide the user with a table of items each with an associated checkbox. >> In this case its a list of IP addresses. and the resultant contents of >> ras_clients/ras_client can be one or more IP addresses delimited by a single >> space. >> e.g. >> >> <selections> >> <selection>a.b.c.d 1.2.3.4 etc </selection> >> >> When the user clicks on Query the instance is submitted to an xpl file that >> generates the results and the user is directed to another fr:tabview where >> the "output" instance is displayed. >> >> The sql statement is currently >> select INET_NTOA(nasip)as >> ip_address,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId >> from eaplog where INET_NTOA(nasip)= >> substring_index(<sql:param type="xs:string" >> select="/selections/selection"/>," ",1) and NOT ( userid like 'host%' and >> status='Success') order by DeviceReportedTime desc limit 200 >> >> Which works just fine if 1 checkbox in the <xforms:repeat> ... is selected. >> The substring_index function ensures that the user can select as many >> checkboxes as they want, they'll get output related to the 1st one. This is >> temporary. What I need to do is use a WHERE...IN (a,b,c...) construct in the >> sql statement e.g. WHERE INET_NTOA(nasip) IN ('a.b.c.d','1.2.3.4'...) >> >> Basically I need to >> replace start of string with a " (' " chars >> replace all spaces with " ',' " chars >> replace end of string with " ' )" chars >> >> which results in an sql statement of the form >> >> select INET_NTOA(nasip)as >> ip_address,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId >> from eaplog where INET_NTOA(nasip) IN >> <sql:param type="xs:string" select="/selections/selection"/> and NOT ( >> userid like 'host%' and status='Success') order by DeviceReportedTime desc >> limit 200 >> >> >> It's all very simple if you can use regular expressions. >> >> Is there any way I can do this somewhere in >> >> xforms:trigger> >> <xforms:label>Query</xforms:label> >> <xforms:action ev:event="DOMActivate"> >> <xforms:send submission="query-switch-logs"/> >> <xforms:dispatch targetid="results" name="fr-toggle"/> >> </xforms:action> >> </xforms:trigger> >> >> before the submission statement? >> >> Rgds >> Alex >> >> >> ========== >> Time for another Macmillan Cancer Support event. This time its the 12 day >> Escape to Africa challenge >> >> View route at >> http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&msa=0&msid=203779866436035016780.00049e867720273b73c39&z=8 >> >> Please sponsor me at http://www.justgiving.com/Alex-Sharaz >> >> >> >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing >> list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws Time for another Macmillan Cancer Support event. This time its the 12 day Escape to Africa challenge View route at http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&msa=0&msid=203779866436035016780.00049e867720273b73c39&z=8 Please sponsor me at http://www.justgiving.com/Alex-Sharaz -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Alex,
I think there is an odd "odt:literalString" type which might work for this. This said it's old and not pretty! -Erik On Sun, Jul 17, 2011 at 2:45 PM, alex sharaz <[hidden email]> wrote: > Magic! > Worked a treat., > .... pone smal problem though. In my sql:param statement I have to define the type as xs:string ..... which puts quotes round The whole parameter. This means I get > > '("a.b.c.d","1.2.3.4")' > > omitting the type argument results in a complaint. Is there any other type setting I can use that'll stop the automatic quote insertion? > Rgds > Alex > > On 15 Jul 2011, at 03:44, Erik Bruchez wrote: > >> You could do something like this. Use a bind to calculate the modified >> value, something like: >> >> <xforms:bind ref="selection2" calculate="concat('(', >> replace(../selection, '\s+', ','), ')')"/> >> >> Then use "selection2" in your SQL instead of "selection". >> >> Anyway, something along these lines. >> >> -Erik >> >> On Thu, Jul 14, 2011 at 7:51 AM, alex sharaz <[hidden email]> wrote: >>> Hi, >>> >>> I'm using >>> >>> <xforms:repeat nodeset="instance('switches-instance')/ras_client"> >>> <xxforms:variable name="switch" select="."/> >>> <xhtml:tr> >>> <xhtml:td><xhtml:center> >>> <xforms:select appearance="full" >>> ref="instance('selected')/selection"> >>> <xforms:item> >>> <xforms:label/> >>> <xforms:value value="$switch/nas_identifier"/> >>> </xforms:item> >>> </xforms:select> >>> </xhtml:center></xhtml:td> >>> <xhtml:td> >>> <xforms:output value="identifier"/> >>> </xhtml:td> >>> </xhtml:tr> >>> >>> >>> ...... >>> <xforms:trigger> >>> <xforms:label>Query</xforms:label> >>> <xforms:action ev:event="DOMActivate"> >>> <xforms:send submission="query-switch-logs"/> >>> <xforms:dispatch targetid="results" name="fr-toggle"/> >>> </xforms:action> >>> </xforms:trigger> >>> ........ >>> >>> to provide the user with a table of items each with an associated checkbox. >>> In this case its a list of IP addresses. and the resultant contents of >>> ras_clients/ras_client can be one or more IP addresses delimited by a single >>> space. >>> e.g. >>> >>> <selections> >>> <selection>a.b.c.d 1.2.3.4 etc </selection> >>> >>> When the user clicks on Query the instance is submitted to an xpl file that >>> generates the results and the user is directed to another fr:tabview where >>> the "output" instance is displayed. >>> >>> The sql statement is currently >>> select INET_NTOA(nasip)as >>> ip_address,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId >>> from eaplog where INET_NTOA(nasip)= >>> substring_index(<sql:param type="xs:string" >>> select="/selections/selection"/>," ",1) and NOT ( userid like 'host%' and >>> status='Success') order by DeviceReportedTime desc limit 200 >>> >>> Which works just fine if 1 checkbox in the <xforms:repeat> ... is selected. >>> The substring_index function ensures that the user can select as many >>> checkboxes as they want, they'll get output related to the 1st one. This is >>> temporary. What I need to do is use a WHERE...IN (a,b,c...) construct in the >>> sql statement e.g. WHERE INET_NTOA(nasip) IN ('a.b.c.d','1.2.3.4'...) >>> >>> Basically I need to >>> replace start of string with a " (' " chars >>> replace all spaces with " ',' " chars >>> replace end of string with " ' )" chars >>> >>> which results in an sql statement of the form >>> >>> select INET_NTOA(nasip)as >>> ip_address,DeviceReportedTime,FromHost,userid,nasPort,status,CallingStationId >>> from eaplog where INET_NTOA(nasip) IN >>> <sql:param type="xs:string" select="/selections/selection"/> and NOT ( >>> userid like 'host%' and status='Success') order by DeviceReportedTime desc >>> limit 200 >>> >>> >>> It's all very simple if you can use regular expressions. >>> >>> Is there any way I can do this somewhere in >>> >>> xforms:trigger> >>> <xforms:label>Query</xforms:label> >>> <xforms:action ev:event="DOMActivate"> >>> <xforms:send submission="query-switch-logs"/> >>> <xforms:dispatch targetid="results" name="fr-toggle"/> >>> </xforms:action> >>> </xforms:trigger> >>> >>> before the submission statement? >>> >>> Rgds >>> Alex >>> >>> >>> ========== >>> Time for another Macmillan Cancer Support event. This time its the 12 day >>> Escape to Africa challenge >>> >>> View route at >>> http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&msa=0&msid=203779866436035016780.00049e867720273b73c39&z=8 >>> >>> Please sponsor me at http://www.justgiving.com/Alex-Sharaz >>> >>> >>> >>> >>> >>> -- >>> You receive this message as a subscriber of the [hidden email] mailing >>> list. >>> To unsubscribe: mailto:[hidden email] >>> For general help: mailto:[hidden email]?subject=help >>> OW2 mailing lists service home page: http://www.ow2.org/wws >>> >>> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws > > ========== > Time for another Macmillan Cancer Support event. This time its the 12 day Escape to Africa challenge > > View route at http://maps.google.co.uk/maps/ms?ie=UTF8&hl=en&msa=0&msid=203779866436035016780.00049e867720273b73c39&z=8 > > Please sponsor me at http://www.justgiving.com/Alex-Sharaz > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
been looking through the dock and i think if i can replace
<selections> <selection>1.2.3.4 2.3.4.5 …</selection> </selections> with <selections> <selection>1234</selection> <selection>2.3.4.5</selection> …... </selections> I can use something of the form <sql:query> select * from book where book_id in (sql:param type="xs:string" select="/query/book-id" separator=","/> </xql:query> as defined in so I need to take a space delimited set of string values and convert them into a dom object A On 28 Jul 2011, at 06:07, Erik Bruchez wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |