Data tag referencing a forms variable

Questions and answers for designing and implementing forms in Servoy

Data tag referencing a forms variable

Postby huber » Tue Aug 30, 2022 11:59 am

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?
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm

Re: Data tag referencing a forms variable

Postby mboegem » Tue Aug 30, 2022 4:30 pm

Works fine for me in NG (not tested on TiNG)
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Data tag referencing a forms variable

Postby huber » Tue Aug 30, 2022 6:42 pm

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.
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm

Re: Data tag referencing a forms variable

Postby mboegem » Fri Sep 02, 2022 11:27 am

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.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Data tag referencing a forms variable

Postby huber » Tue Sep 13, 2022 5:07 pm

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!
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 6 guests