Javasript cannot work with outsystems datatype.

Hi I am trying to develop a room booking systems.

So the UI must show like the 1st image.

And also have to select the available time slot with drag and drops. 

The problems is I cannot use javascript directly to get the total room numbers. Actually I don't know how to pass the outsystems variable types to javascript.And also we have external database. So, I can't fulfill my boss wish. 

Any help ? 

It will be very nice if someone guide me to make it easy :) .

P.S I am quite new to Outsystems. I just used it for almost a month plus i took online training for 2 weeks.

If you have the variable available during the load of the screen you can do it this way:

At the end of your page, add an expression and put Escape Content to No.

The content of the expression can then be:

"<script type='text/javascript'>
   var custom1Mask = new InputMask([fieldBuilder.inputNumbers(4, 4)], '"+EditYearFieldsYear.Id+"');","")

In the example above, I genereted some JS code using the EditYearFieldsYear.Id coming from the server side.