Problem with creating a Dropdownlist and can't find a solution


Hi

I just started using Outsystems and I have problem creating a Dropdown list from a record, I created multiple dropdown lists with each connected to different record, I want it to show these record and register it in my database, for example:

I have Shifts dropdown list

it should show

B

C

A

And when the user chooses A it register under shift in the database.

Thanks

Hi Faris,


You need to bind your dropdwon list witht he ShiftIdentifer variable then that variable will hold the id of the selected values from dropdown.atfer that you can assign the ShiftIdentifer selected value into the Entity Foreign key column

(ArrFlightDom entity set Shift column from the Shiftidentifer)

Hope this helps

Salman Ansari wrote:

Hi Faris,


You need to bind your dropdwon list witht he ShiftIdentifer variable then that variable will hold the id of the selected values from dropdown.atfer that you can assign the ShiftIdentifer selected value into the Entity Foreign key column

(ArrFlightDom entity set Shift column from the Shiftidentifer)

Hope this helps

I get this error when I put "SelectedShiftId"

"Invalid Expression
Can't identify 'SelectedShiftId' element in expression."


Also the droplist only shows the title of entity not record, like I have an entity called Shifts when I link it to the droplist, the droplist shows only "Shift" text inside it not the records I made.

I've been stuck with this droplist issue for days


Hi Salman,


Firstly, once you select from the dropdown I hope you are saving its id under a local variable(let's name it shifts, datatype shift.id).

in your save action try assigning it with the variable where it should get registered.


shifts= newvariable.id


Can you try this and let me know if it helps?

Ankita Kulkarni wrote:

Hi Salman,


Firstly, once you select from the dropdown I hope you are saving its id under a local variable(let's name it shifts, datatype shift.id).

in your save action try assigning it with the variable where it should get registered.


shifts= newvariable.id


Can you try this and let me know if it helps?

I did what you said but still not fixed I don't what or where did I mess up. Here is a pic on how its showing to me:


If you can see here, in current shift droplist it only shows the name of attribute I put in the options text and not the records I created.


Hi Faris Abdullah Almozini,

1) Introduce a local Variable called SelectedShiftId (Shifts Identifier data type) and map the Local variable to ShiftDropdown widget Variable field and set the OptionText and OptionsValue field value as mentioned below.

On the selection of Shift option using the dropdown widget, the respective shift option ShiftId will get stored in SelectedShiftId Local Variable which you can use further in the source record attribute value of CreateOrUpdateArrFlightDom Entity action.

PFA - includes .oml Solution file

Let us know if you face any more difficulty.


Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Faris Abdullah Almozini,

1) Introduce a local Variable called SelectedShiftId (Shifts Identifier data type) and map the Local variable to ShiftDropdown widget Variable field and set the OptionText and OptionsValue field value as mentioned below.

On the selection of Shift option using the dropdown widget, the respective shift option ShiftId will get stored in SelectedShiftId Local Variable which you can use further in the source record attribute value of CreateOrUpdateArrFlightDom Entity action.

PFA - includes .oml Solution file

Let us know if you face any more difficulty.


Hope this helps you!


Regards,

Benjith Sam

Hi Benjith

Thanks for your help and for everyone's help, I did everything you mentioned here and checked what you attached.

Its still has the same problem:


As you can see here the droplist shows "Shift" while it should shows three options I added as a record (B, C, A)



Hi Faris Abdullah Almozini,

This is the UI canvas view, which I can see in my Service studio :)

It might be some visual glitches, check with the actual application output.



Regards,

Benjith Sam

Benjith Sam wrote:

Hi Faris Abdullah Almozini,

This is the UI canvas view, which I can see in my Service studio :)

It might be some visual glitches, check with the actual application output.



Regards,

Benjith Sam

I see the same thing but when you click on the droplist does it show all records (A, C and B)?

In my pc it shows only A


Please check the file attached after I did what you suggested.

Hi Faris Abdullah Almozini,

Sorry I didn't obsereve the complete .oml file previously, I found some mistakes in your solution file...


1) The Shifts Static Entity

  a) It consists of an FK attribute called Shifts which is of ShiftsId data type, making a self loop.

  b) The respective static entity is not having any Label attribute to hold the Record Label value i.e. A, B and C

- Update the Shifts Static Entity definition as shown below...

Introduce a Label attribute to the Shifts Static entity, which is of Text data type and manually assign the Label attribute text value (i.e "A", "B" and "C") to each Shifts static entity record.

Note: Don't pass the Entities.Shifts.A as Label attribute Value for the record.

Entities.Shifts.A - it is an identifier for that specific record not a Text value.

PFA - includes the updated .oml file


Hope this helps you


Regards,

Benjith Sam

Hi Faris Abdullah Almozini,


PFA - includes updated Latest Shared .oml file.


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Faris Abdullah Almozini,

Sorry I didn't obsereve the complete .oml file previously, I found some mistakes in your solution file...


1) The Shifts Static Entity

  a) It consists of an FK attribute called Shifts which is of ShiftsId data type, making a self loop.

  b) The respective static entity is not having any Label attribute to hold the Record Label value i.e. A, B and C

- Update the Shifts Static Entity definition as shown below...

Introduce a Label attribute to the Shifts Static entity, which is of Text data type and manually assign the Label attribute text value (i.e "A", "B" and "C") to each Shifts static entity record.

Note: Don't pass the Entities.Shifts.A as Label attribute Value for the record.

Entities.Shifts.A - it is an identifier for that specific record not a Text value.

PFA - includes the updated .oml file


Hope this helps you


Regards,

Benjith Sam

Thanks I'm making a big progress, but I think there's a problem with connecting all the records together. The droplist only show the first value which is "A". See the pic below:





Hi Faris Abdullah Almozini,

Please confirm the success of the implementation after testing the application using Browser or in Native device :)

Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Faris Abdullah Almozini,

Please confirm the success of the implementation after testing the application using Browser or in Native device :)

Hope this helps you!


Regards,

Benjith Sam

I tried just now testing it, but I receive this error:

Upgrade Error
Could not change the type of attribute 'Shift' of entity 'Arrflightdom' from 'Text' to 'Integer'. There are values that cannot be converted to 'Integer'. Consider creating a new attribute and logic to migrate existing values.

And this's where the issue originated, from ArrFlightDom Shift data type:

Faris Abdullah Almozini wrote:

I tried just now testing it, but I receive this error:

Upgrade Error
Could not change the type of attribute 'Shift' of entity 'Arrflightdom' from 'Text' to 'Integer'. There are values that cannot be converted to 'Integer'. Consider creating a new attribute and logic to migrate existing values.

You do have two options to sort out this issue.


1) Add a new attribute called ShiftsLabel (Text Data Type) to the Shifts Static Entity

2) Cut (Ctrl + X) the Shifts Static entity and Paste (Ctrl+V) the same static entity and publish the module

I would prefer going with the 2 option :)


Hope this helps you.


Regards,

Benjith Sam

Benjith Sam wrote:

Faris Abdullah Almozini wrote:

I tried just now testing it, but I receive this error:

Upgrade Error
Could not change the type of attribute 'Shift' of entity 'Arrflightdom' from 'Text' to 'Integer'. There are values that cannot be converted to 'Integer'. Consider creating a new attribute and logic to migrate existing values.

You do have two options to sort out this issue.


1) Add a new attribute called ShiftsLabel (Text Data Type) to the Shifts Static Entity

2) Cut (Ctrl + X) the Shifts Static entity and Paste (Ctrl+V) the same static entity and publish the module

I would prefer going with the 2 option :)


Hope this helps you.


Regards,

Benjith Sam

I tried both options, but still no luck


Faris Abdullah Almozini wrote:

I tried both options, but still no luck


Two options:

1)  Cut (Ctrl + X) the Shifts Static entity and Paste (Ctrl+V) the same static entity - Rename the Static Entity  and publish the module

i.e. Rename the static entity from Shifts ---> ShiftType (do the necessary code changes)

2) Revert the attribute data type to integer and add a new Text attribute i.e. ShiftLabel and publish.

I would prefer option1


Hope this helps!


Regards,

Benjith Sam

Benjith Sam wrote:

Faris Abdullah Almozini wrote:

I tried both options, but still no luck



Two options:

1)  Cut (Ctrl + X) the Shifts Static entity and Paste (Ctrl+V) the same static entity - Rename the Static Entity  and publish the module

i.e. Rename the static entity from Shifts ---> ShiftType (do the necessary code changes)

2) Revert the attribute data type to integer and add a new Text attribute i.e. ShiftLabel and publish.

I would prefer option1


Hope this helps!


Regards,

Benjith Sam

I'm sorry I know I'm taking so much of your time, but I did every step and published it and nothing changed.

I have attached the updated project file.



Solution

Faris Abdullah Almozini wrote:

I'm sorry I know I'm taking so much of your time, but I did every step and published it and nothing changed.

I have attached the updated project file.



If the above mentioned steps is not working out then..

1) Close the existing module without doing any changes

2) Reopen the module

3) Copy and Paste the Shifts Static entity and do all the required changes (rename the newly created entity)

4) Update the old Shifts Static entity reference with the newly created Static entity and publish the module 


Hope this helps you!


Regards,

Benjith Sam

Solution

Benjith Sam wrote:

Faris Abdullah Almozini wrote:

I'm sorry I know I'm taking so much of your time, but I did every step and published it and nothing changed.

I have attached the updated project file.



If the above mentioned steps is not working out then..

1) Close the existing module without doing any changes

2) Reopen the module

3) Copy and Paste the Shifts Static entity and do all the required changes (rename the newly created entity)

4) Update the old Shifts Static entity reference with the newly created Static entity and publish the module 


Hope this helps you!


Regards,

Benjith Sam

sorry for the late response I managed to fixed, thanks


Faris Abdullah Almozini wrote:

sorry for the late response I managed to fixed, thanks

No worries. You are welcome :)

Regards,

Benjith Sam