Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi,

 

I need my SQL results in a 12 hr clock, not 24 hr clock.

 

I tried Hour( ) and Minute ( ) but there was not change.

 

I had to change my "Time" field to a "GetAsText" field so I could see my time as 9:00 AM or 9:00 PM.

 

But now I can not sort the SQL results.

 

please see pic.

 

Any assistance I would be grateful.

 

Thank you.

 

Tom :-)

SQL 24Hr.pdf

Just curious - wouldn't:

 

SELECT Description, EventTimeCalc
FROM Events

WHERE ...
ORDER BY EventTime

 

work for you?

  • Author

Hi Comment,

 

That was the first thing I tried, but the SQL Select statement throws a " ? "

 

I guess the "Ordered Fields" must be contained within the SQL ??

 

Anyway … any ideas I would be grateful.

 

Thank you.

It works for me, although I am testing this in v.11 using a plugin. Still, I believe it should work as advertised - and it is so advertised in FMI's SQL documentation. Why don't you eliminate all other possible causes (such as the WHERE clause) to see if the error is indeed caused by what you think it is.

 

BTW, I don't think that the sort order is being "ignored": what you show seems to be ordered in alphabetical order - as you would expect when sorting by a text type field.

Another thought: if =

 

SELECT Description, EventTimeCalc, EventTime
FROM Events

WHERE ...
ORDER BY EventTime

 

does work for you, try changing it to =

 

SELECT Description, EventTimeCalc, LEFT(EventTime, 0)
FROM Events

WHERE ...
ORDER BY EventTime

  • Author

post-89394-0-81329400-1387931160_thumb.pHi Comment,

 

It works … thank you.

 

Now I have the " - " to cancel out after the AM / PM. Please see attached .pic

 

ExecuteSQL ( " 
 
Select Description, EventTimeCalc, Left('EventTime',0)
 
From Events  
 
WHERE ( ? BETWEEN EventStart AND EventEnd )
 
Order By EventTime ASC " ; " - " ; "" ;
 
cDateOfFirstPortal + 27 )
 
There's got to be a better way to handle this.  Hmm … is there a function in SQL that would convert the time field ??  I've been researching the net and googling and review 3wSchool but to no avail.
 
Any insight here I would be grateful.
 
Tom :-)
Now I have the " - " to cancel out after the AM / PM.

 

Why don't you simply substitute it out? Something like:

Substitute ( SQLresult & ¶ ; " - ¶" ; ¶ )
There's got to be a better way to handle this.  Hmm … is there a function in SQL that would convert the time field ??

 

 

Not sure if it's any better, but this works for me:

STRVAL(MOD(HOUR(Timefield)-1,12)+1)
+':'+
STRVAL(RIGHT('0'+STRVAL(MINUTE(Timefield)),2))
+' '+
CASE WHEN Timefield < TIME '12:00:00' THEN 'AM' ELSE 'PM' END
  • Author

Hi Comment :-)

 

Thank you ... thank you … thank you.

 

Now I've got something to take apart and learn.  This is excellent!!

 

Tom :-)

 

 

ExecuteSQL ( " 
 
Select Description, 
 
STRVAL(MOD(HOUR(EventTime)-1,12)+1)
+':'+
STRVAL(RIGHT('0'+STRVAL(MINUTE(EventTime)),2))
+' '+
CASE WHEN EventTime < TIME '12:00:00' THEN 'AM' ELSE 'PM' END
 
From Events  
 
WHERE ( ? BETWEEN EventStart AND EventEnd )
 
Order By EventTime Asc " ; "  -  " ; "" ;
 
cDateOfFirstPortal + 27  )

post-89394-0-74507900-1387944927_thumb.p

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.