After adding cache _DS.cacheAddMethod the display field is not working (nothing is displayed)

Hello, friends

I want to get rid of the warning:

Display method displayPlannedHarvest on control displayPlannedHarvest in form EBProcurementForecast not cached.

So I added these code lines in form:

[Form]
public class EBProcurementForecast extends FormRun
{

[DataSource]
class EBProcurementForecast
{
///


///Adds both datasource display methods in cache
///

public void init()
{
super();
EBProcurementForecast_DS.cacheAddMethod(tableMethodStr(EBProcurementForecast, displayItemName));
EBProcurementForecast_DS.cacheAddMethod(tableMethodStr(EBProcurementForecast, displayPlannedHarvest));

}

}

However, afterwards the display method stops working at all (nothing is shown, previously everything worked fine).

Additional method which I tried was - Form field property:cache data method I changed to yes. The results where the same, that is, the display methods stopped working at all (field didnt show anything).

Any solution from your experience?

Kind regards,

Roberts

What do you find when you debug the method?

By the way, your code is difficult to read because it lost indentation. Please always use Insert > Insert Code to prevent this problem. This is the result:

[Form]
public class EBProcurementForecast extends FormRun
{
	[DataSource]
	class EBProcurementForecast
	{
		/// <summary>
		///Adds both datasource display methods in cache
		/// </summary>
		public void init()
		{
			super();
			EBProcurementForecast_DS.cacheAddMethod(tableMethodStr(EBProcurementForecast, displayItemName));
			EBProcurementForecast_DS.cacheAddMethod(tableMethodStr(EBProcurementForecast, displayPlannedHarvest));
		}
	}
}

Thanks, Martin.

Will use the appropriate method next time. Thanks for the quick reply. The debugger helped. It seems that after I save the new row of values display method is working and values are showed, however I need to update (use display method) as soon as one of the fields in table is modified. Tried to insert something like this:

    [Control("Real")]
    class EBProcurementForecast_AreaHa
    {
        public boolean modified()
        {
            boolean ret;

            ret = super();

            EBProcurementForecast_DS.cacheAddMethod(tableMethodStr(EBProcurementForecast, displayPlannedHarvest));

            return ret;
        }

    }

But the error shows that cacheAddMethod can be only used in init.

Kind regards,

Roberts

Simple BProcurementForecast_DS.reread() solved the problem.

Thanks!

Kind regards,

Roberts