10 years ago
Topic

Hi,

I would like to extract sql results in forms when I select an option in a parent filed(dynamic o cascade).

In example: I have a contact table with Name, Adress and City of customer.

And when I create  a different form (for service order in my example) I put a  customer dynameic field to select my customer but after I would like automaticaly to complete other two text field 'adress' and 'city' by extracting result in contact table depending of my parent selected field.

-Which type of field I need to use?

-Where and what code I need to extract data related?

Thanks 

Arnaud

Get a VIP membership
10 years ago
1
Level 1

Hi adegard,

In order to implement the feature you described, you can use a "select dynamic" field and the custom attributes inside this field.

How you can use the custom attributes of a "select dynamic" field"? Let us suppose that you have in database three columns in the contact table: name, address and city.

You can define attributes by clicking on "toogle" in the configuration of the "select dynamic" field. new settings appear at the bottom. Let fill the following:

  • Custom Attribute / Column : attr-address / address
  • Custom Attribute / Column : attr-city / city

If you do that, you will have for each option of your select dynamic value as name and 2 attributes "address" and "city".

You can use after that conditional states to set another fields by the values of these both attributes.

Regards,
Mehdi.

10 years ago
0
Level 2

Hi Mehdi, 

Tanks for your answer. But I'm not sure to anderstand, then I send you some screenshots to see wher I made mistakes.

To anderstand, suppose that my order form contain 2 fields:

- my Dynamic field name is "soggetto_fatt" 

- I create an another text field named "indirizzo_fatt" (where I would like to extract data from my contact table, when I select a name in my dynamic field)

- my adress field in my contact table is called "indirizzo" with ID 5063

Then here is what I did:

- I put attribute line in my dynamic field options : "Custom Attribute / Column : attr-indirizzo / indirizzo" (see screenshot1)


- I put conditional state in my "indirizzo_fatt" field like figure 2, following instructions - is "Filled by: the id of a field you want to retrieve the value.

In order to retrieve a custom attribute, use fieldid@attribute" (where fieldid is 5063 and created attribute was "indirizzo" in dynamic field)

Thanks for your help!

4229 Posts
Kadministrator
10 years ago
0
Level 1

Hi,

you are not looking at the right place, see bellow image, you nee dto click on Toggle to open multiple atributes boxes. Also your syntax is wrong, you need to enter pairs of attribute name in first box  and database column that holds value in second, e.g. attr-city  in first box and city in second.

4229 Posts
Kadministrator
10 years ago
1
Level 1

You also need to update to 3.4.1 before you cna use this option.

10 years ago
0
Level 2

Hi Klas, 

thanks to your answer I upgrade seblod and put atributes in the right place:

But the problem remain: when I change my dynamic field, I didn't optain any results in my conditioated field...

Could you please have a look of the syntax bellow of my condional state for the result field?

Thanks a lot

Have a good evening!

Arnaud

10 years ago
1
Level 1

Hi adegard,

In the configuration of the conditional state you should fill "the name of the field @ the name of the attribute".

I'm not sure if 5029 is the name of the select dynamic field. In the other hand you should fill "name_of_select_dynamic_field@attr-indirizzo".

Regards,
Mehdi

10 years ago
0
Level 2

HI Mehdi,

Now it's working n form view, but it's not saved in content view...? why?

Arnaud

Get a Book for SEBLOD