Page 1 of 1

condition in Spd

Posted: Mon Aug 12, 2019 8:30 pm
by dsvivass
Hello,
I'm trying to assign constraints to certain nodes, and I'm using dependencies inside of the values field. the problem is that, when I successfully assign the first constraint and I'm assigning a property to the second node the first group node takes the values of the last group. I'm pretty sure that the problem is inside of the "node" in the dependencies field because the values are "global". How can I assign those properties to just one node, what should I add to the dependencies field to refer to the auto group that is created and not to the values of all of the groups.

Thank you.

<condition n='asig_restriccion' pn='Asignar restriccion' ov='point' >
<value n='cond_rest_y' pn='Restriccion en "y"' values='ninguno,valor' v='ninguno'>
<dependencies value='ninguno' node='//value[@n="ind_y"]' att1="v" v1="0"/>
<dependencies value='ninguno' node='//value[@n="rest_y"]' att1="state" v1="hidden" att2='v' v2='0'/>
<dependencies value='valor' node='//value[@n="ind_y"]' att1="v" v1="1"/>
<dependencies value='valor' node='//value[@n="rest_y"]' att1="state" v1="normal" att2='v' v2='0'/>
</value>
<value n='ind_y' pn='Indicador y' state='hidden'/>
<value n='rest_y' pn='y' state='hidden' />
</condition>

Re: condition in Spd

Posted: Tue Aug 13, 2019 1:47 pm
by fjgarate
Hi @dsvivas
what you want is achieved with

Code: Select all

  <condition n='asig_restriccion' pn='Asignar restriccion' ov='point' >
    <value n='cond_rest_y' pn='Restriccion en "y"' values='ninguno,valor' v='ninguno'>
      <dependencies value='ninguno' node='../value[@n="ind_y"]' att1="v" v1="0"/>
      <dependencies value='ninguno' node='../value[@n="rest_y"]' att1="state" v1="hidden" att2='v' v2='0'/>
      <dependencies value='valor' node='../value[@n="ind_y"]' att1="v" v1="1"/>
      <dependencies value='valor' node='../value[@n="rest_y"]' att1="state" v1="normal" att2='v' v2='0'/>
    </value>
    <value n='ind_y' pn='Indicador y' state='hidden'/>
    <value n='rest_y' pn='y' state='hidden' />
  </condition>


As you can see
node='//value[@n="rest_y"]'
referred to "All 'values' in the xml whose 'n' field equals to 'rest_y'".´


This should be replaced by
node='../value[@n="rest_y"]'
that means "All values following the local path -from the current node, go to parent (..) and find values whose field n equals to rest_y"


Hope it works!
Javi Gárate

Re: condition in Spd

Posted: Tue Aug 13, 2019 2:37 pm
by dsvivass
Thank you very much Javi!!!!! I tried a lot of things and nothing worked, this completely solve the problem!
Regards.

Re: condition in Spd

Posted: Tue Aug 13, 2019 3:06 pm
by escolano
An advice (not related to your question).
Use english messages everywhere in the code,
E.g instead
pn='Restriccion en "y"''
Use
Pn='Y restriction'
And to be show in other language, like Spanish use our program "RamTranslator" https://www.gidhome.com/gid-plus/tools/485/download-ramtranslator
that scan the code and extract the strings to translate in a table. Translate them and export the message catalog, es.msg and copy it to the problemtype to show its own messages in the current GiD selected language

Re: condition in Spd

Posted: Tue Aug 13, 2019 3:15 pm
by dsvivass
Hi @escolano, I'll take your advice.
Thank you!