Changing parameter values according to other parameter choice in Processing script using QGIS 3?Populating a...

Count repetitions of an array

Time-efficient matrix elements grouping and summing

Plausible reason to leave the Solar System?

Is there a file that always exists and a 'normal' user can't lstat it?

Does it take energy to move something in a circle?

How to write cases in LaTeX?

Why avoid shared user accounts?

Why does 0.-5 evaluate to -5?

Memory usage: #define vs. static const for uint8_t

Broad Strokes - missing letter riddle

Is a creature that sees a Medusa's eyes automatically subjected to a saving throw?

Plausible reason for gold-digging ant

Is there a way to store 9th-level spells in a Glyph of Warding or similar method?

Do authors have to be politically correct in article-writing?

Cat is tipping over bed-side lamps during the night

Is there a way to not have to poll the UART of an AVR?

Is there any advantage in specifying './' in a for loop using a glob?

How to create a label containing values from different layers in QGIS

What is the industry term for house wiring diagrams?

Can we "borrow" our answers to populate our own websites?

Critique vs nitpicking

Subsurf on a crown. How can I smooth some edges and keep others sharp?

Is there a verb that means to inject with poison?

"Starve to death" Vs. "Starve to the point of death"



Changing parameter values according to other parameter choice in Processing script using QGIS 3?


Populating a Value List in one Parameter, from Values Derived from a Second Parameter, PythonPython toolbox - keep parameter value updated after re-altering parametersUsing Shortcut for QGIS Processing Script?Using QGIS processing tools in standalone script?Letting user choose from 2 options for QGIS Processing script input parameter?Set default for folder parameter in QGIS processing scriptsExporting processing modeler as Python script in QGIS 3?Load layer in QGIS legend from Processing script [QGIS 3]Using temporary layer as input for other algorithm in Processing scriptUsing parameterAsSink in QGIS processing script?













3















I couldn't find anything about this problem.



Suppose to have the first parameters in a Processing script defined as an Enum:



   self.addParameter(
QgsProcessingParameterEnum(
self.CHOICE,
self.tr('Choose the parameter'),
['param1', 'param2']
)
)


While the second one as a number:



self.addParameter(
QgsProcessingParameterNumber(
name=self.VALUE,
description=self.tr('My value'),
type=QgsProcessingParameterNumber.Double,
defaultValue=40,
optional=False,
minValue=0,
maxValue=100
)
)


Is it possible to change the minValue, maxValue, description, ecc.. of the second parameter depending on the first or second choice of the first parameter already in the GUI?



e.g. if the user choose param1 then the second parameter should become:



self.addParameter(
QgsProcessingParameterNumber(
name=self.VALUE,
description=self.tr('My value'),
type=QgsProcessingParameterNumber.Double,
defaultValue=40,
optional=False,
minValue=0,
maxValue=100
)
)


while if he choose param2 it should became:



self.addParameter(
QgsProcessingParameterNumber(
name=self.VALUE,
description=self.tr('My AWESOME value'),
type=QgsProcessingParameterNumber.Double,
defaultValue=0,
optional=False,
minValue=50,
maxValue=500
)
)









share|improve this question





























    3















    I couldn't find anything about this problem.



    Suppose to have the first parameters in a Processing script defined as an Enum:



       self.addParameter(
    QgsProcessingParameterEnum(
    self.CHOICE,
    self.tr('Choose the parameter'),
    ['param1', 'param2']
    )
    )


    While the second one as a number:



    self.addParameter(
    QgsProcessingParameterNumber(
    name=self.VALUE,
    description=self.tr('My value'),
    type=QgsProcessingParameterNumber.Double,
    defaultValue=40,
    optional=False,
    minValue=0,
    maxValue=100
    )
    )


    Is it possible to change the minValue, maxValue, description, ecc.. of the second parameter depending on the first or second choice of the first parameter already in the GUI?



    e.g. if the user choose param1 then the second parameter should become:



    self.addParameter(
    QgsProcessingParameterNumber(
    name=self.VALUE,
    description=self.tr('My value'),
    type=QgsProcessingParameterNumber.Double,
    defaultValue=40,
    optional=False,
    minValue=0,
    maxValue=100
    )
    )


    while if he choose param2 it should became:



    self.addParameter(
    QgsProcessingParameterNumber(
    name=self.VALUE,
    description=self.tr('My AWESOME value'),
    type=QgsProcessingParameterNumber.Double,
    defaultValue=0,
    optional=False,
    minValue=50,
    maxValue=500
    )
    )









    share|improve this question



























      3












      3








      3


      1






      I couldn't find anything about this problem.



      Suppose to have the first parameters in a Processing script defined as an Enum:



         self.addParameter(
      QgsProcessingParameterEnum(
      self.CHOICE,
      self.tr('Choose the parameter'),
      ['param1', 'param2']
      )
      )


      While the second one as a number:



      self.addParameter(
      QgsProcessingParameterNumber(
      name=self.VALUE,
      description=self.tr('My value'),
      type=QgsProcessingParameterNumber.Double,
      defaultValue=40,
      optional=False,
      minValue=0,
      maxValue=100
      )
      )


      Is it possible to change the minValue, maxValue, description, ecc.. of the second parameter depending on the first or second choice of the first parameter already in the GUI?



      e.g. if the user choose param1 then the second parameter should become:



      self.addParameter(
      QgsProcessingParameterNumber(
      name=self.VALUE,
      description=self.tr('My value'),
      type=QgsProcessingParameterNumber.Double,
      defaultValue=40,
      optional=False,
      minValue=0,
      maxValue=100
      )
      )


      while if he choose param2 it should became:



      self.addParameter(
      QgsProcessingParameterNumber(
      name=self.VALUE,
      description=self.tr('My AWESOME value'),
      type=QgsProcessingParameterNumber.Double,
      defaultValue=0,
      optional=False,
      minValue=50,
      maxValue=500
      )
      )









      share|improve this question
















      I couldn't find anything about this problem.



      Suppose to have the first parameters in a Processing script defined as an Enum:



         self.addParameter(
      QgsProcessingParameterEnum(
      self.CHOICE,
      self.tr('Choose the parameter'),
      ['param1', 'param2']
      )
      )


      While the second one as a number:



      self.addParameter(
      QgsProcessingParameterNumber(
      name=self.VALUE,
      description=self.tr('My value'),
      type=QgsProcessingParameterNumber.Double,
      defaultValue=40,
      optional=False,
      minValue=0,
      maxValue=100
      )
      )


      Is it possible to change the minValue, maxValue, description, ecc.. of the second parameter depending on the first or second choice of the first parameter already in the GUI?



      e.g. if the user choose param1 then the second parameter should become:



      self.addParameter(
      QgsProcessingParameterNumber(
      name=self.VALUE,
      description=self.tr('My value'),
      type=QgsProcessingParameterNumber.Double,
      defaultValue=40,
      optional=False,
      minValue=0,
      maxValue=100
      )
      )


      while if he choose param2 it should became:



      self.addParameter(
      QgsProcessingParameterNumber(
      name=self.VALUE,
      description=self.tr('My AWESOME value'),
      type=QgsProcessingParameterNumber.Double,
      defaultValue=0,
      optional=False,
      minValue=50,
      maxValue=500
      )
      )






      pyqgis qgis-processing qgis-3 parameters






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 7 '18 at 19:54









      PolyGeo

      53.6k1780240




      53.6k1780240










      asked Jun 7 '18 at 13:13









      matteomatteo

      1,244825




      1,244825






















          1 Answer
          1






          active

          oldest

          votes


















          0














          No, there's no support for this in existing QGIS versions (<= 3.6). You'd need to address this at runtime, and add a check that the evaluated parameter value falls into the acceptable range (raising a QgsProcessingException otherwise)






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "79"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f285570%2fchanging-parameter-values-according-to-other-parameter-choice-in-processing-scri%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            No, there's no support for this in existing QGIS versions (<= 3.6). You'd need to address this at runtime, and add a check that the evaluated parameter value falls into the acceptable range (raising a QgsProcessingException otherwise)






            share|improve this answer




























              0














              No, there's no support for this in existing QGIS versions (<= 3.6). You'd need to address this at runtime, and add a check that the evaluated parameter value falls into the acceptable range (raising a QgsProcessingException otherwise)






              share|improve this answer


























                0












                0








                0







                No, there's no support for this in existing QGIS versions (<= 3.6). You'd need to address this at runtime, and add a check that the evaluated parameter value falls into the acceptable range (raising a QgsProcessingException otherwise)






                share|improve this answer













                No, there's no support for this in existing QGIS versions (<= 3.6). You'd need to address this at runtime, and add a check that the evaluated parameter value falls into the acceptable range (raising a QgsProcessingException otherwise)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 12 mins ago









                ndawsonndawson

                19.7k22741




                19.7k22741






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f285570%2fchanging-parameter-values-according-to-other-parameter-choice-in-processing-scri%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    (145452) 2005 RN43 Классификация | Примечания | Ссылки |...

                    Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                    Энтрерриос (город) Содержание История | Географическое...