Page 1 of 1

Data tag referencing a forms variable

PostPosted: Tue Aug 30, 2022 11:59 am
by huber
On a NG Classic (and NG Titanium) form, I am using a label (Label - WebComponent -> bootstrapcomponents-label) with a standard tag like %%selectedIndex%% which works fine.
Using on the same form a data tag like %%numberOfLessons%% which references a forms variable does not work. It works perfectly on a Smart Client form though.

Am I missing something?

Re: Data tag referencing a forms variable

PostPosted: Tue Aug 30, 2022 4:30 pm
by mboegem
Works fine for me in NG (not tested on TiNG)

Re: Data tag referencing a forms variable

PostPosted: Tue Aug 30, 2022 6:42 pm
by huber
Thanks Marc. I tested a bit more and found, when I move the label, for example some pixels to the left, it shows the (correct) value. But only once. The value (an integer with a i18n key) changes when another record is selected. But the new value is not displayed. Unless I move the label again. Very strange.
Don't know if it may have to do with the ARM based Servoy Developer. I am using a MacBook Pro 2021.

Re: Data tag referencing a forms variable

PostPosted: Fri Sep 02, 2022 11:27 am
by mboegem
Hi Robert,

I guess what you are saying is that you change the content of a form variable depending on the selected record which is not reflected on the label.
Just tested, but working fine for me.

Code: Select all
var fvText = 'Count 0';

var fvCount = 0;


function onAction() {
   fvCount++;
   fvText = 'Count ' + utils.numberFormat(fvCount, '#');
}


Have added a bootstrap label to the form that has a value '%%fvText%%' for the text property.
Added a button triggering the onAction method.

This all works as expected.

Re: Data tag referencing a forms variable

PostPosted: Tue Sep 13, 2022 5:07 pm
by huber
Hi Marc

Thanks a lot for your example. This situation works in my solution as well. But my case which did not work is like this:

Code: Select all
/**
* @type {Number}
*
* @properties={typeid:35,uuid:"26D2D226-2FEB-4B3E-A4F1-01B8B900F684",variableType:8}
*/
var numberOfLessons = null;

   var queryNumberOfLessons = "\
      SELECT\
         COUNT(*)\
      FROM
      ...

   numberOfLessons = databaseManager.getDataSetByQuery(scopes.coreConfiguration.defaultDataSourceServerName, queryNumberOfLessons, null, -1).getValue(1, 1);
   ...



where numberOfLessons is the form variable used in the data tag.

Now I found that adding the code line

application.updateUI();

after the numberOflessons SOLVED the problem, i. e. displays the number of lessons in the data tag.

By the way, this is code in the fetchEvents() function of full calendar.

Thanks again for your help!