Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » sqlite and dropdate / editdate etc (Can you receive an integer value and display as date?)
Re: sqlite and dropdate / editdate etc [message #54889 is a reply to message #54888] Fri, 25 September 2020 08:18 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14257
Registered: November 2005
Ultimate Member
jimlef wrote on Fri, 25 September 2020 07:19
Is there a way to have an sqlctrl dropdate for example that retrieves a field from your db as int and translates that to date? As in
17093 = 01/07/2019

Currently, it only seems to show the integer value...

Thanks!


Nothing ready made, but easy to implement.

For EditField, you should assign custom made Convert (that is basically a class that converts Value to String and back).

DropDate might be a bit more complicated. I would probably made it a child of some helper Ctrl and would do the conversion in its parent SetData/GetData. Something like

struct DropDateInt {
        DropDate dd;
        const Date zero_date = Date(1970, 1, 1);
	virtual void   SetData(const Value& data) { dd <<= zero_date + (int)data; }
	virtual Value  GetData() const            { return (Date)~dd - zero_date; }

        DropDateInt() { Add(dd.SizePos()); }
}


(not tested, there might be some caveat I do not see now...)

Why do you need this? Sqlite3 seems to have date type AFAIK...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How does All_Tables determine if a table exists?
Next Topic: Program changing column
Goto Forum:
  


Current Time: Sat May 10 18:51:35 CEST 2025

Total time taken to generate the page: 0.02152 seconds