How To AutoComplete increment Identify in database...

How To AutoComplete increment Identify in database...

Hello, how are you all?

I have a doubt about InputAutoComplete ...
I have an application that uses the AutoComplete ComboBox in 2. On insertion of the value of AutoComplete in the bank it says there was an error ..
mansagem error:
"The INSERT statement conflicted with the FOREIGN KEY constraint" OSFRK_OSUSR_ynp_Consultoria_OSSYS_USER_USER_CONSULTOR. "The conflict occurred in database" outsystems_, "table" dbo.ossys_User ", column 'ID'. Has Been The statement terminated."

I think the AutoComplete input variables to be saving the text and not identify type .. causing this error .. someone able to help me showing me how do I save the database a Identift a User, and not his name like Text ..
I appreciate ..

Adilson Batista.
Hi Adilson and welcome to Outsystems Community,

This is happening because you're doing an insert on
"Consultoria" table and you are not assigning the field "consultor" which is mandatory.

You have to assign that field before doing the create on the table. To get the Id
through the autocomplete, use the widget  "Input_AutoComplete_GetIdentifier" from "RichWidgets".
You only need to send the "InputWidgetId" as input and for what I see in your screenshoot it is "cod_cliente.Id".

After you only need to assign your field "cod_cliente" with the value returned on the Input_AutoComplete_GetIdentifier and do the create.

Hope it helps,

Sérgio Oliveira

Where i apply  the function WidGets"Input_AutoComplete_GetIdentifier" on action"Save"?

I need increment my attribute "cod_cliente" of table "Cliente" with the value of Auto_Increment...
My attribute "cod_cliente" is type FK, and the value of Auto_Increment is Text... i need know how to take the ID of value of Auto_Increment... i need incrementing one FK of table "Cliente" in attribute "cod_cliente"...

thank u..
Hi Adilson,

Yes,  you should use the 
"Input_AutoComplete_GetIdentifier" on action "Save", it wil returns a text and you need to convert it to an identifier of Cliente table, then assign it to the "cod_cliente" and do the create on the table.

I don't understood well what you mean with the auto_increment but I send you an example of how to do that in attach.


Sérgio Oliveira

Conseguir  chegar no meu objetivo, sua ajuda foi de muita utilidade!

muito obrigado. espero contar sempre com voce.

Adilson Batista. :D
To reach my goal, your help was very useful! thank you.
I hope you always count on.
Adilson Batista. : D