Seleccion en COMBO BOX segun dato recibido de base mysql - Forum

Forum Navigation
You need to log in to create posts and topics.

Seleccion en COMBO BOX segun dato recibido de base mysql

tengo un "ComboBox" con 2 items: Admistrador, Comun

Recibo unos datos desde una base mysql y lo que necesito es que si el dato recibido es "Administrador" me muestre ese item seleccionado en el ComboBox

 

he probado de diferentes maneras sin resultado alguno, ejemplo, asignandole a la variable del combobox el valor recibido desde la base de datos

Tampoco veo una opcion de buscar dentro del ComboBox si existe algun item o deberia manejarlo tal como si fuera un array?

Ya logre solucionarlo trabajandolo como si fuera un array y despues buscando dentro del mismo el valor recibido

@gustavo1973 ¿te refieres a hacer algo como lo que muestro en el archivo adjunto?
Sólo tienes que asignar a la variable del ComboBox el valor que quieres que se muestre.

Para buscar detro del ComboBox efectivamente se busca como si fuera un Array. Hay un ejemplo muy completo incluido con VisualNEO Web.

Saludos.

Uploaded files:
  • You need to login to have access to uploads.

@luishp

Ahora mi pregunta va dirigida a un objeto tipo "Date" que recibe la fecha a reflejar desde una base mysql, no logro hacerlo, me muestra vacio ese objeto

. La fecha recibida es sacada de "NeoTable" en la variable "[Fecha_Recibida] y tiene el formato "yyyy-mm-dd"

. El objeto tipo DATE que debe recibir la fecha tiene la variable [Fecha]

SetVar [Fecha_Recibida] [neoTableRow.Fecha]
neoDateInit
neoDateCreate [Fecha] "[Fecha_Recibida]" "dd/mm/yyyy"

 

@gustavo1973

. The received date is taken from "NeoTable" in the variable "[Fecha_Recibida] and is formatted as "yyyy-mm-dd"
SetVar [Fecha_Recibida] [neoTableRow. Date]

Can you follow this command with an AlertBox that verifies that you have a valid date in the "yyyy-mm-dd" format ?

. The DATE type object to receive the date has the variable [Date]
neoDateInit

neoDateInit is no longer required; in the published (not beta) version, this is done automatically.

 neoDateCreate [Date] "[Fecha_Recibida]" "dd/mm/yyyy"

a) why is the third parameter "dd/mm/yyyy" if [Fecha_Recibida] is formatted as "yyyy-mm-dd" ?

b) [Date] might be some kind of reserved variable; best to use something like [gusDate]

it shows me empty that object

a) did you check the Inspect >>> Console for any error messages that the chart library may have logged ?

b) try ...

neoDateCreate [gusDate] "[Fecha_Recibida]" "yyyy-mm-dd"
neoDateAsString "[gusDate]" "yyyy-mm-dd" [testAnswer]
AlertBox "testAnswer" "is [testAnswer]" ""

Please post your results here.

 

@gaev

the value received in [Date_Received] is "1973-10-09"
The return value in "testAnswer" is "is yyyy-00-Tu" if I use the example posted by you

@gustavo1973

As I did not have access to your Table data, I tried this ...

neoDateCreate [gusDate] "1973-10-09" "YYYY-MM-DD"
neoDateAsString "[gusDate]" "YYYY-MM-DD" [testAnswer]
AlertBox "testAnswer" "is [testAnswer]" ""

... and it worked; the key was that date formats have to be in UPPERCASE !

Please try this code ... after it works, just replace the first line with ...

neoDateCreate [gusDate] "[Fecha_Recibida]" "YYYY-MM-DD"

.. if it does not work, try ...

AlertBox "Fecha_recibida" "is [Fecha_Recibida]" ""
neoDateCreate [gusDate] "[Fecha_Recibida]" "YYYY-MM-DD"

 

... to verify that the variable contains the expected content.

@gaev

your example works correctly now capitalizing the date format
but what I can't do is see the date reflected in the "DateInput" object
as I see the date that is selected in this object has the format "dd/mm/yyyy" 
so modify your code to this format and the result is that it shows me the date 
well in the variable "[testAnswer]" but not in the object where the user must select the date

The code:
neoDateCreate [gusDate] "[Fecha_Recibida]" "DD/MM/YYYY"
neoDateAsString "[gusDate]" "DD/MM/YYYY" [testAnswer]

give the object "DateInput" the same variable name "testAnswer"
 


@gustavo1973:

what I can't do is see the date reflected in the "DateInput" object
as I see the date that is selected in this object has the format "dd/mm/yyyy"

so modify your code to this format and the result is that it shows me the date
well in the variable "[testAnswer]" but not in the object where the user must select the date

The code:
neoDateCreate [gusDate] "[Fecha_Recibida]" "DD/MM/YYYY"
neoDateAsString "[gusDate]" "DD/MM/YYYY" [testAnswer]

1) It may be due to Windows Regional settings, but when I setup a DateInput widget, it shows yyyy-mm-dd

2) if [Fecha_Recibida] is already in the DD/MM/YYYY format, I do not see any benefit of these two commands.

3) This post has morphed from a ComboBox enquiry to a possible neoDate issue to a DateInput issue; I do not have experience with the DateInput widget; so I am not sure how to correctly populate the associated variable of this widget ... no matter what value I specify for its initial value, it always pops up the Calendar with Today's date.

However, when I place an AlertBox in the widget's change event, it displays something like this ...

Thu May 06 2021 00:00:00 GMT-0400 (Eastern Daylight Time)

Perhaps you can advise me about a SetVar command that (for you) properly updates the variable associated with this widget ... and pops up the calendar associated with this value.

 

I'm going to create a new "Post" with this problem, maybe someone has a solution
Thank you very much for your time and your help.