Page 1 of 1

Fullcalendar2 not compatible with UUID

PostPosted: Sat Apr 06, 2024 1:58 am
by john1598360627
I setup the Fullcalendar2 however I encountered an issue related to UUID typing.

The way I setup the Fullcalendar2 was like so;

* Fullcalendar2 gets filled with events defined from database table records

* Each event is given the id to the record's UUID

* By clicking on the event on the Fullcalendar2, I can get the UUID and load the record directly to go to a separate Edit form


However, I'm having a problem. I can't load the UUID from the event object.

When I grab the 'event.id', which contains the UUID, and try to load the foundset of the edit form with the UUID... it just errors out.

CODE
Code: Select all
/**
* <b>onEventClickMethodID</b> will be called when the user clicks an event.
*
* @param {CustomType<svy-fullcalendar2.EventObject>} event
* @param {JSEvent} jsEvent
* @param {CustomType<svy-fullcalendar2.ViewType>} view
*
* @private
*
* @properties={typeid:24,uuid:"A4902C65-9BE9-48AA-835F-01F9FBF45AB9"}
*/
function onEventClick(event, jsEvent, view) {
   
   // get event's resource id that matches record id to load record
   
   scopes._DEBUG.output_Application( 'Event ID', 'calendar_fullcalendar2', event.id )
   
   select_record( event.id )
   
}

Code: Select all
/**
* @param {Object} ID
*
* @properties={typeid:24,uuid:"649DA160-C1AC-46B9-BE60-FADCAB24E9DE"}
*/
function select_record( ID ) {
   
   /** @type {UUID} */
   var UUIDvalue = ID
   
//   scopes._DEBUG.output_Application( 'UUDIDvalue', 'calendar_fullcalendar2', UUIDvalue )
   
   forms.calendar_event_edit.load_recordUUID( UUIDvalue )
   
   scopes.NAV.change_forwardForm( 'calendar_event_edit', scopes.NAV.define_FormTypes.Edit )
}


ERROR
Code: Select all
Exception Object: java.lang.IllegalArgumentException: A query must start with 'SELECT', optionally preceded by 'WITH' or 'DECLARE', and must contain 'FROM':D347DFC7-A8D0-4D5B-A859-6924230BE57E
MSG: A query must start with 'SELECT', optionally preceded by 'WITH' or 'DECLARE', and must contain 'FROM':D347DFC7-A8D0-4D5B-A859-6924230BE57E
ERROR com.servoy.j2db.util.Debug - A query must start with 'SELECT', optionally preceded by 'WITH' or 'DECLARE', and must contain 'FROM':D347DFC7-A8D0-4D5B-A859-6924230BE57E (Form Context: calendar_fullcalendar2), JSEvent(type = onEventClickMethodID, source = Component: <Component:'fullcalendar2_arm' of parent FormUI for FormController[form: calendar_fullcalendar2, fs size:8,visible: true, selected record: Record[DATA:Row(db:/arm_data/calendar_full)[DATA:calendar_full_uuid=E1D9F345-BB02-4C9D-A78E-10F32738E055,calendar_date_start=null,calendar_date_end=null,calendar_title=null,  CALCULATIONS: {}]]  COLUMNS: calendar_full_uuid,calendar_date_start,calendar_date_end,calendar_title,,destroyed:false], with spec: svy-fullcalendar2 >, formName = calendar_fullcalendar2, elementName = fullcalendar2_arm, timestamp = 2024-04-05 16:06:49.813,modifiers = 0,x =503,y = 553,data = null)


CONSOLE
Code: Select all
[ INFO ] { calendar_fullcalendar2 } Event ID ( D347DFC7-A8D0-4D5B-A859-6924230BE57E )



Keep in mind, when I create a new record and load the UUID into the foundset of the edit form it works completely fine. I'm only having issues loading the UUID with regards to after getting it from the event object.

The issue is most likely due to typing. I noticed that the event object is defaulting the 'event.id' to an Object type. And for whatever reason Servoy isn't detecting the UUID as a UUID cus the Event object typing has converted it into an Object.

I'm not sure how to fix this typing issue so that Servoy can detect the UUID properly after Fullcalendar2 turned it into an object.

Any help is appreciated! But if there's no quick fix, this may need a patch.

Re: Fullcalendar2 not compatible with UUID

PostPosted: Sun Apr 07, 2024 1:05 pm
by mboegem
Hi John,

if you really need a UUID object for your query, you should convert the UUID string coming from the calendar like this:
Code: Select all
application.getUUID(<IdFromCalendar>)


Using the JSDoc typing doesn't convert a UUID string to a UUID object, it will just fool the code-parser.

Hope this helps

Re: Fullcalendar2 not compatible with UUID

PostPosted: Mon Apr 08, 2024 11:54 pm
by john1598360627
mboegem wrote:Hi John,

if you really need a UUID object for your query, you should convert the UUID string coming from the calendar like this:
Code: Select all
application.getUUID(<IdFromCalendar>)


Using the JSDoc typing doesn't convert a UUID string to a UUID object, it will just fool the code-parser.

Hope this helps

That fixed it, thank you!


Code: Select all
   /** @type {UUID} */
   var UUIDvalue = application.getUUID( ID.toString() )