condition in Spd

Moderator: GiD Team

dsvivass
Posts: 4
Joined: Mon Aug 12, 2019 8:10 pm

condition in Spd

Postby dsvivass » Mon Aug 12, 2019 8:30 pm

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>
User avatar
fjgarate
Posts: 3
Joined: Wed Nov 18, 2015 8:11 pm

Re: condition in Spd

Postby fjgarate » Tue Aug 13, 2019 1:47 pm

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
dsvivass
Posts: 4
Joined: Mon Aug 12, 2019 8:10 pm

Re: condition in Spd

Postby dsvivass » Tue Aug 13, 2019 2:37 pm

Thank you very much Javi!!!!! I tried a lot of things and nothing worked, this completely solve the problem!
Regards.
User avatar
escolano
Posts: 1562
Joined: Thu Sep 18, 2014 3:31 pm

Re: condition in Spd

Postby escolano » Tue Aug 13, 2019 3:06 pm

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
dsvivass
Posts: 4
Joined: Mon Aug 12, 2019 8:10 pm

Re: condition in Spd

Postby dsvivass » Tue Aug 13, 2019 3:15 pm

Hi @escolano, I'll take your advice.
Thank you!

Return to “Customization”

Who is online

Users browsing this forum: No registered users and 1 guest