Copiar fecha en una celda - Forum

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

Copiar fecha en una celda

Hola a todos.

Necesito copiar la fecha del dia (la puse en u boton con [DateShort] y que se ejecute con la tecla c.

La idea es que cuando se esta en la fecha del producto tocando la tecla c me cambie la fecha de la celda por la del [DateShort].

adjunto imagen. gracias.

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

@neobook

I am going by Google's automatic translation of your post's text (it does not translate text inside images) ... so I might be wrong in determining what kind of assistance you are seeking.

1) I see from the image that the TextEntry Box is receiving the c keys.

I verified that if you assign the c key as a shortcut to a Button, its code does get activated when I press this key (even when the focused object is a TextEntry Box).

However, I do not recommend such a shortcut, as it might bet activated even when you did not intend to do it ... choose some key combination (like Ctrl+Alt+C) that you would not normally type as content.

Having said that, are you seeking help in assigning a shortcut key to a Button ?

2) Or are you wanting to know how to update the FECHA field in the current record (the row with the arrow head in column 1).

Assuming you are using NeoBookDBPro to access your Database, in order to update a field in the current record, all you have to do is ...

SetVar "[yourDB.yourTableName.yourFieldName]" "yourFieldValue"

 

If you were having trouble getting the Button code to be invoked when you typed the shortcut key, I suggest you start by assigning this command to the Button's click event ...

AlertBox "Hello" "neobook"

... to verify that the shortcut key is working.

Then, you could try ...

AlertBox "producto" "[yourDB.yourTableName.yourProductoFieldname]"

It appears (from the image of the values in FECHA) that this might just be a Text field ... in which case, the command to update it is ...

SetVar "[yourDB.yourTableName.yourFECHAFieldName]""[DateShort]"

However, if the field is defined as some Date field, it gets a bit more complicated when it comes time to update the field ... you may first have to transform [DateShort] to a format that is expected by the database for that field

If it is defined as a Date field, you will need to tell us details of the definition of the FECHA field and confirm that the format of the [DateShort] value is dd/mm/yyyy.

NO SE ENTENDIO MI PEDIDO, A VER...

necesito que cuando se haga click en algun campo de la columna fecha, en vez de poner la fecha manualmente, la cambie automaticamente por [DateShort].

AL boton dateshort le pongo por ejemplo in (short cut key CTRL + V)  la idea es que cuando me ponga en alguna celda la COLUMNA FECHA en de escribir 09/09/2019 al accionar el boton [DateShort] se ponga automaticamente en el campo seleccionado

 

ENG:

I DIDN'T UNDERSTAND MY ORDER, TO SEE ...

I need that when you click on a field in the date column, instead of setting the date manually, it automatically changes it to [DateShort].

To the dateshort button I put for example in (short cut key CTRL + V) the idea is that when I put in a cell the DATE COLUMN in writing 09/09/2019 when activating the [DateShort] button it will automatically be put in the field selected
Uploaded files:
  • You need to login to have access to uploads.

@neoook

I need that when you click on a field in the date column, instead of setting the date manually, it automatically changes it to [DateShort].

I believe the click event is reserved for the plugin's internal Grid actions ... however, you can specify a subroutine to be invoked whenever a row is double clicked ... take a look at the Help file for the dbpSetGridProperties command ... in the Properties parameter, you can specify the name of this Subroutine ...

OnDoubleClick=subroutine

The name of a subroutine from your publication's Subroutine Action. The subroutine specified here will be executed whenever the user double clicks anywhere within the grid.

You can use the dbpGetActiveField action in the subroutine to determine which field was clicked if needed.

... in this subroutine, you can code ...

SetVar "[yourDb.yourTable.yourFieldName]" "[DateShort]"

... hope that is what you were aiming to achieve.

To the dateshort button I put for example in (short cut key CTRL + V) the idea is that when I put in a cell the DATE COLUMN in writing 09/09/2019 when activating the [DateShort] button it will automatically be put in the field selected

I am not sure what you are asking here, but (as stated before) you can also code the click event for the Button to be ...

SetVar "[yourDb.yourTable.yourFieldName]" "[DateShort]"

... then, whenever you click on the button, it will replace the date field of the current row to the value of [DateShort].

la idea es que al querer editar alguna fecha,
accionando el boton con la fecha del dia,
se copie en la celda automaticamente.

 

ENG:

The concept is that when you want to edit a date,
by pressing the button with the date of the day,
it is automatically copied into the cell.

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

SetVar "[datos.Tabla1.FECHA]" "[DateShort]"

no funciona

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

when clikeo changes the data for many numbers, he seems not to understand the command

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

@neobook

The images are very helpful.

SetVar "[datos.Tabla1.FECHA]" "[DateShort]"
no funciona

Please make the shortcut for the button something other than Ctrl+C ... as Ctrl+C will be trapped by Windows (copy function) ... and never reach your Pub ... try something like Ctrl+Alt+C

In the LeftClick section of this Button, add command ...

AlertBox "Button Activated" "[datos.Tabla1.$RecNum] ... [datos.Tabla1.FECHA]"

This will tell us ...

a) instead of using the shortcut key combo, first try and click the button with the mouse to see if the code gets invoked; if the AlertBox does not pop up, there is a problem with the code in the LeftClick event section.

b) if it does pop up, now try and invoke it by using the shortcut character(s) ... if the Button's LeftClick event code is not triggered (i.e. if the AlertBox does not pop up), there is a problem with your shortcut selection

Once you get a pop up to occur, the content will tell us the row number and FECHA field value at the time; please post your experience/results.

 

dbpPopupDateSelector "Left=618;Top=149;DateFormat=dd/mm/yyyy" "[NOMBRE]"
dbpGetActiveField "datos" "Tabla1" "fecha"

 

me aparece el almanaque pero cuando selecciono la fecha no me la cambia en mi celda.

botton action:

AlertBox "Botón activado" "[datos.Tabla1. $ RecNum] ... [datos.Tabla1.FECHA]"

pero no me cambia nada, cree un boton con la variable [datos.Tabla1.FECHA] para ver lo que salia.

 

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

Gaev gracias por atenderme, pero el codigo que me pusistes

AlertBox "Botón activado" "[datos.Tabla1. $ RecNum] ... [datos.Tabla1.FECHA]"

"[datos.Tabla1. $ RecNum] no toma nada.

la otra opcion es usar

dbpPopupDateSelector "Izquierda = 618; Superior = 149; DateFormat = dd / mm / aaaa" "[NOMBRE]"
dbpGetActiveField "datos" "Tabla1" "fecha"

 

me aparece el almanaque pero cuando selecciono la fecha no me la cambia en mi celda.

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

@neobook

Let us tackle one issue at a time ...

a) The fact that you get a popup (AlertBox) confirms that the code for LeftClick event is being activated.

b) the reason you did not get the value of the first variable is because you typed it incorrectly ... notice that in your code, [datos.Tabla1. $ RecNum] has SPACES before and after the $ sign ... try ... [datos.Tabla1.$RecNum] ... and tell us the value(s) returned by the AlertBox command.

Please advise if you activated the code with your mouse (click) or a shortcut key.

In any case, add the command ...

SetVar "[datos.Tabla1.FECHA]" "[DateShort]"

... AFTER the AlertBox command ... tell us if the value of the field in the current record/row was updated.

We can address the other stuff (dbpPopupDateSelector) later (separately).

si esta mal redactado.

lo que me falta es que al seleccionar en el almanaque cambie la fecha de la celda seleccionada.

cuando se edita la celda, si uno quiere aparece el almanaque.

Este guarda la seleccion en la variable [almanaque]

dbpPopupDateSelector "Left=625;Top=153;InitialDate=;DateFormat=dd/mm/yyyy" "[almanaque]"

 

ahora la pregunta es ¿ como hago para que la celda quede con lo que uno elije en el almanaque.

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

ya obtengo los datos de la varieable. pero...

no guarda datos en la celda, no se modifica queda igual que antes.

SetVar "[datos.Tabla1.FECHA]" "[DateShort]".

por eso opto por el calendario, una u otra manera me sirven pero no modifica la celda.

osea la ayuda es :

1: SetVar "[datos.Tabla1.FECHA]" "[DateShort]". pero no funciona no cambia los datos de la celda fecha.

2: usar dbpPopupDateSelector pero no logro que al seleccionar cambie la celda. Se  clickea en el calendario y la celda no se modifica.

sigo sin poder resolver.

 

 

@neobook

ya obtengo los datos de la varieable. pero...
no guarda datos en la celda, no se modifica queda igual que antes.

I already get the data from the varieable. but...
it does not save data in the cell, it is not modified it remains the same as before.

Progress ... so now the issue is with the database record not being updated ...

1) Can you tell us ...

a) what database you are deploying ? ... MS Access, mySQL, SQLite etc. etc. ?
b) what is the FECHA field defined as ? ... String, Date, Time, DateTime etc. ?

2) Using the dbpSetGridProperties command, try and specify these properties ...

a) ReadOnly=No

ReadOnly=yes/no
Yes = the table cannot be edited from the grid. No = grid allows editing.

b) RowSelect = No

RowSelect=yes/no
Yes = the entire row will appear selected. No = only individual cells can be selected. When RowSelect=Yes, the grid does not permit editing.

3) Try adding the dbpSaveEdits command (AFTER updating the date field).

hola

1- la base es de access

dbpSetGridProperties "datos" "Tabla1" "Color=Window;Font=Arial Black,12,Bold,ANSI_CHARSET;FontColor=WindowText;AlternateRowColor=255,255,191;AlternateRowFontColor=Black;RowHeight=22;TitleColor=Lime;TitleFont=Arial,14,Bold,ANSI_CHARSET;TitleFontColor=Black;TitleRowHeight=22;HighlightColor=0,121,0;HighlightFontColor=White;EditColor=Window;EditFontColor=WindowText;ShowTitles=Yes;3DTitles=Yes;ShowGraphics=Yes;ShowIndicator=No;ShowColumnLines=Yes;ShowRowLines=Yes;GridLineWidth=6;GridLineColor=235,235,235;AllowRowResize=Yes;AllowColumnResize=Yes;AllowColumnSort=Yes;ConfirmDelete=No;ReadOnly=Yes;EditOnly=No;RowSelect=Yes;ShowScrollBars=Yes;ShowNavigationBar=Yes;GetDefaultValues=Yes;OnDoubleClick=

entrada de pagina de edicion:

dbpCloseDatabase "datos"
dbpOpenAccessDatabase "datos" "[PubDir]Database11.mdb" ""
dbpOpenTable "datos" "Tabla1" ""
dbpRefresh "datos" "Tabla1"
dbpSort "datos" "Tabla1" "PRODUCTO=ASC"
dbpSaveEdits "datos" "Tabla1"
dbpSetFieldProperties "datos" "Tabla1" "PRECIO" "DisplayFormat=$ 0.#0"
dbpShowGrid "datos" "Tabla1" "Rectangulo2"
dbpTranslateHints "First=PRIMERO;Previous=ANTERIOR;Next=SIGUIENTE;Last=ULTIMO;Add=AGREGAR ;Delete=BORRAR;Edit=EDITAR;Save=GUARDAR;Cancel=CANCELAR;Refresh=REFRESCAR;DeletePrompt=BORRAR REGRISTO?;DeleteTitle=CONFIRMAR"
dbpSetGridProperties "datos" "Tabla1" "ShowRowLines=No;ReadOnly=No;EditOnly=Yes;RowSelect=No"

@neobook

1- la base es de access

Note that MS Access has an issue with date formats ... it does not use your Windows Regional setting for date formats ... it always uses American Date format ... which is mm/dd/yyyy ... so, when you pass it 22/09/2019, it thinks it is the 9th day of the 22nd month of 2019 !!!!

dbpSetGridProperties "datos" "Tabla1" "ShowRowLines=No;ReadOnly=No;EditOnly=Yes;RowSelect=No"

Try and place this command BEFORE the dbpShowGrid command.

b) what is the FECHA field defined as ? ... String, Date, Time, DateTime etc. ?

I did not get your answer to this question.

May I suggest that you temporarily change your Button code to make a change to a String field (instead of the date field ) ? ... see my explanation here https://visualneo.com/forum/topic/dbppopupdateselector#postid-2556 for the reason.

That way, we can separate your problems with date incompatibilities from any issues with the Grid display ... perhaps ...

SetVar "[datos.Tabla1.PRODUCTO]" "ABCDEF"

... if this works, then we can focus on the Date translation issues; otherwise, we can focus on the Grid update issues.

 

b) what is the FECHA field defined as ? ... String, Date, Time, DateTime etc. ?

I did not get your answer to this question.

is date

pero como podria verificarlo.

 

probe

dbpSetGridProperties "datos" "Tabla1" "ShowRowLines=No;ReadOnly=No;EditOnly=Yes;RowSelect=No"

Try and place this command BEFORE the dbpShowGrid command. (y no funciona).

ahora probare tu sugerencia. luego te cuento

Gracias por todo amigo. Problema resuelto.

SetVar "[datos.Tabla1.FECHA]" "! [Almanaque]"

 

thanks to you Gaev