how to display the results based on selected values from select box?

SKR December 16, 2013

Hi,

can any one answer my question with example?

I would like to display the result on change of select box value and even in the select options will also come from database.

1. how to display the mysql records in select box?

2. how do I display the mysql results onchange of select box options?

ex: I have 3 different countries in select box like(India, Dubai & London)

when I select India it should retrieve all major city names from India,

when I select Dubai it should retrieve all major city names from Dubai,

when I select London it should retrieve all major city names from London,

can this be done using RUN and Scaffolding plugin, I'm not sure as I'm beginner.

If you provide any example will be great help.

Regards

Sudhu

3 answers

0 votes
SKR December 23, 2013

Hi

I found the answer

here is the documentation

· Go to the page where you want to add drop box

· Click on edit page

· Click on Insert

· Select "Other Macros"

· Choose "Run with user form and parameters"

· On the right side of the popup window enter necessary fields.

· Eg :

· Unique id for this run macro instance = name of the macros

· Replace parameter list = " {run:autorun=true|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page| replace=g2::hidden value:Hidden description:hidden,s1::?Location:select::India::Dubai::England"

Text which is highlighted in blue are optional parameters.

Text which is highlighted in green replace - parameters, this parameter will act like dummy parameters and some times it must be declared with any value(but hidden field will be preferred) and some times it is not required.

Text which is highlighted in red is actually the parameters for the select box, which can only be static values and it should correspond to the values in the database and is not case sensitive.

{run:autorun=true|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page| replace=g2::hidden value:Hidden description:hidden, s1::?Location:select::India::Dubai::England

{run:autorun=true|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page| replace= g2::hidden value:Hidden description:hidden, s1::?Location:select::india:India:dubai:Dubai:England:London

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 17, 2013

You use the Run macro to allow the user to make the selection and then SQL-query Macro to run the query against the database based on the user selected values. Start with that before doing anything with dynamically generating the choice values. Look at the Documentation and various How to's for the run macro and similarly the Documentation and How to's for the sql macro.

SKR December 17, 2013

Hi

can you tell me, what am I doing wrong here?

{run:autorun=false|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page|

replace=

s1:choice value 1:?Select:select::choice value 1:choice text 1:choice value 2:choice text 2:choice value 3:choice text

}

Regards
Sudhu
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 17, 2013

This works for me:

{run:autorun=false|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page|
replace=
s1:choice value 1:?Select:select::choice value 1:choice text 1:choice value 2:choice text 2:choice value 3:choice text}
$s1
{run}

SKR December 18, 2013

Thanks Bob, however I have one more doubt regarding sql parameters.

Please find below attached image and also how do I pass region name dynamically through variable in sql query?

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2013

?s2 isn't proper sql syntax. ? in sql represents a parameter marker. Did you mean $s2?

SKR December 18, 2013

I'm not sure very much, but my requirement is like below:

I have a select box where I will have couple of region, when a selection is made, the query should retrieve data based on selected value

when I select India it should pull the data which is relevant to India region, same way it applicables for rest of the regions.

please find below code which I have written:

{run:autorun=true|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page| replace=s2:?Select:select::India::Dubai::London

select ?p1, * from AC_users where region = 'india' instead of this I want

something like below so that I can get the selected value from the select box

select ?p1, * from AC_users where region = '$region'

Thanks alot

Regards

Sudhu

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 18, 2013

Um, Bob's point is that your SQL is incorrect - ?p1 will not work, it probably should be $p1

SKR December 18, 2013

I tried that but no luck ... :(

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2013
select * from AC_user where region = '$s2'

$s2 will be replaced by the run macro with the selected value.

SKR December 18, 2013

I tried even that also but for some reason it is not working.

here I'm attaching the screenshots and code which is generating select box options.

{run:autorun=true|heading=Heading text|prompt=Prompt text|titleRun=Submit|help=help page| replace=s2:?Select:select::India::Dubai::London

Please do let me know if I need to do any changes in the above code.

SQL Query :

select initials, first_name, last_name, email, region, dept from AC_users where region = '$s2'

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 18, 2013

On the sql query macro, select parameter to "Show SQL" and see the sql statement that is being run. Then copy and paste the statement in your database specific query tool.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 16, 2013

Jira doesn't have a scaffolding plugin. That's for Confluence.

We can't really give you a decent answer to this until we know whether it's Jira or Confluence and if you really mean scaffolding or something else.

Alexej Geldt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 17, 2013

question is tagged for confluence.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2013

Ta. It wasn't when it was first published.

SKR December 17, 2013

I had changed it to confluence

Suggest an answer

Log in or Sign up to answer