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

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

This widget could not be displayed.

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.

question is tagged for confluence.

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

I had changed it to confluence

This widget could not be displayed.

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.

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

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}

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?

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

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

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

I tried that but no luck ... :(

select * from AC_user where region = '$s2'

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

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'

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.

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

128 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you