Time not visible in a Table

A have a field Date and Time format in a table.

Unfortunately, I can’t see the time and I did not find a setup way to put the time visible.

Any advise?

Thanks for your help.

Regards,
Pym

Hi Pym,

You can achieve that with code, toLocaleTimeString() more specifically.
Disconnect the tablet from the dataset and use the following code.
Make sure to add the missing table fields to match the ones in your collection.

export function dataset1_ready() { 
	$w("#dataset1").getItems(0, 20) //gets 20 items
  .then( (result) => {
    let items = result.items;
    items.map(item => { //loops for each item
    	if (item.newField) { //makes sure the field is not empty
    		item.newField = item.newField.toLocaleTimeString(); //changes the format to only show the time
    	}
    })
    $w("#table1").rows = items; //populates the table
  } )
  .catch( (err) => {
    let errMsg = err.message;
    let errCode = err.code;
  } );
}

Hi Ido,

Thanks for your help.

If I disconnect the dataset, I guess I have to connect each field in my table manually to the field in the dataset ?
What do you mean by “Make sure to add the missing table fields to match the ones in your collection” ?

Thanks
Pym

Hello Pym,

The script will populate the table. there is no need to connect it to a dataset.
In addition, make sure to add the correct columns to your table (manage table > set the field names to match the field keys in your collection)

Hi Ido,

It works fine !!!
Many thanks for your help.
Regards,
pym

1 Like

Someone can explain how to use this code?

I don’t know where I have to put it to works. I put it into the $w.onReady( but did not work for me.

Why should you have to use code though. Bit of a fail of the table.