web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

The type 'VarString' is not supported as a return value.

(0) ShareShare
ReportReport
Posted on by 3,110

Hi Experts,

I developed a report with data builder and controller class as i am running my report this error i am getting"The type 'VarString' is not supported as a return value."

Check my code below

[
SRSReportQueryAttribute(queryStr(JDCustomerInvoice)),
SRSReportParameterAttribute(classStr(JDCustomerInvoiceContract))
]
class JDCustomerInvoiceDp extends SRSReportDataProviderBase
{
TransDate Todate, FromDate;

JDCustomerInvoiceContract contract;
JDCustomerInvoiceTmp JDCustomerInvoiceTmp;
CustInvoiceTrans custInvoiceTrans,CustInvoiceTransLocal;
CustInvoiceJour custInvoiceJour;
CustTable custtable;
InventTable inventTable;

}


[SRSReportDataSetAttribute("JDCustomerInvoiceTmp")]
public JDCustomerInvoiceTmp getJDCustomerInvoiceTmp()
{
select * from JDCustomerInvoiceTmp;
return JDCustomerInvoiceTmp;
}


public void insertTmp()
{

JDCustomerInvoiceTmp.CustName = custInvoiceJour.invoiceName();
JDCustomerInvoiceTmp.AccountNum = custInvoiceJour.InvoiceAccount;
JDCustomerInvoiceTmp.InvoiceDate = custInvoiceJour.InvoiceDate;
JDCustomerInvoiceTmp.CustGroup = custInvoiceJour.CustGroup;
JDCustomerInvoiceTmp.SalesGroup = SalesTable::find(custInvoiceJour.SalesId).SalesGroup;
JDCustomerInvoiceTmp.PartyCountry = CustTable::find(custInvoiceJour.InvoiceAccount).PartyCountry;
JDCustomerInvoiceTmp.PartyCity = CustTable::find(custInvoiceJour.InvoiceAccount).PartyState;

// JDCustomerInvoiceTmp.SalesOriginId = custInvoiceJour.SalesOriginId;
JDCustomerInvoiceTmp.SalesMan =DirPartyTable::findRec(SalesTable::find(custInvoiceJour.SalesId).WorkerSalesResponsible).Name;
//JDCustomerInvoiceTmp.Section = custInvoiceJour.InvoiceAccount;
JDCustomerInvoiceTmp.ItemId= custInvoiceTrans.ItemId;
JDCustomerInvoiceTmp.ItemName= custInvoiceTrans.itemName();
JDCustomerInvoiceTmp.ItemGroupId= InventTable::find(custInvoiceTrans.ItemId).itemGroupId();
//JDCustomerInvoiceTmp.ModelGroupId= InventTable::find(custInvoiceTrans.ItemId).modelGroupId();
JDCustomerInvoiceTmp.Qty = custInvoiceTrans.Qty;
JDCustomerInvoiceTmp.LineAmount = custInvoiceTrans.LineAmount;

select firstonly custtable where custtable.AccountNum == custInvoiceJour.InvoiceAccount;

JDCustomerInvoiceTmp.Email = custtable.Email9;
JDCustomerInvoiceTmp.Phone = custtable.TelePhone9;
JDCustomerInvoiceTmp.Region =custtable.Region9;
JDCustomerInvoiceTmp.Registration = custtable.RegistrationStatus9;
JDCustomerInvoiceTmp.InChargePerson = custtable.InChargsePerson9;
JDCustomerInvoiceTmp.CrNumber = custtable.CRNumber9;
JDCustomerInvoiceTmp.TheNameInCr = custtable.TheNameinCR9;
JDCustomerInvoiceTmp.CreditMax = custtable.CreditMax;
JDCustomerInvoiceTmp.PaymentTerm = custtable.PaymentTerm9;
JDCustomerInvoiceTmp.Section = custtable.CustomerSection9;
JDCustomerInvoiceTmp.PartyCity = custtable.City9;
JDCustomerInvoiceTmp.PartyCountry = custtable.Country9;
JDCustomerInvoiceTmp.SalesGroup = custtable.SalesGroup9;

select firstOnly inventTable where inventTable.ItemId == custInvoiceTrans.ItemId;
JDCustomerInvoiceTmp.Color = inventTable.Color;
JDCustomerInvoiceTmp.Size = inventTable.Size;
JDCustomerInvoiceTmp.Class = inventTable.Class;
JDCustomerInvoiceTmp.SubClass = inventTable.SubClass;
JDCustomerInvoiceTmp.Style = inventTable.Style;
JDCustomerInvoiceTmp.Category = inventTable.Category;
JDCustomerInvoiceTmp.FullDescription = inventTable.FullDescription;

JDCustomerInvoiceTmp.insert();

}


public void processReport()
{

Query query;
QueryRun queryRun;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;

query = this.parmQuery();

contract = this.parmDataContract();
FromDate = contract.parmFromDate();
ToDate = contract.parmToDate();
query.dataSourceNo(1).addRange(fieldnum(CustInvoiceJour, InvoiceDate)).value(queryRange(FromDate, ToDate));

queryRun = new QueryRun(query);

while(queryRun.next())
{
JDCustomerInvoiceTmp.clear();
custInvoiceTrans = queryRun.get(tablenum(CustInvoiceTrans));
custInvoiceJour = queryRun.get(tablenum(CustInvoiceJour));
this.insertTmp();

}
}


Data Contract Class

[ DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(JadcoReportBuilder))
]

class JDCustomerInvoiceContract
{
TransDate Todate, FromDate;
str City;
str Status;
str Region;


}

[DataMemberAttribute("City"),
SysOperationLabelAttribute("City")]
public str parmCity(str _city = city)
{
city= _city;
return City;
}


[DataMemberAttribute("From date"),
SysOperationLabelAttribute("From date")]
public TransDate parmFromDate(TransDate _fromDate = fromDate)
{
fromDate = _fromDate;
return fromDate;
}


[DataMemberAttribute(" Region"),
SysOperationLabelAttribute(" Region")]
public str parmRegion(str _region = Region)
{
Region= _region;
return Region;
}


[DataMemberAttribute(" Status"),
SysOperationLabelAttribute(" Status")]
public str parmStatus(str _status = Status)
{
Status= _status;
return Status;
}

[DataMemberAttribute("To Date"),
SysOperationLabelAttribute("To date")]
public TransDate parmToDate(TransDate _ToDate = ToDate)
{
Todate = _ToDate;
return ToDate;
}

Report Builder class


public class JadcoReportBuilder extends SysOperationAutomaticUIBuilder //SysOperationAutomaticaUIBuilder


{
JDCustomerInvoiceContract DialogContract;
DialogField DialogCity;
DialogField DialogRegion;
DialogField DialogStatus;
DialogField DialogSalesGroup;

}

private void citylookup(FormStringControl _lookup)
{
QueryBuildDataSource querybuilddatasrcoue;

Query query= new Query();


SysTableLookup systablelookup;
if(_lookup != null)
{
systablelookup = SysTableLookup::newParameters(tableNum(CustTable ), _lookup);

querybuilddatasrcoue=query.addDataSource(tableNum(CustTable));
systablelookup.addLookupfield(fieldNum( CustTable, city9),true);
systablelookup.addLookupfield(fieldNum( CustTable, Region9),true);

systablelookup.addLookupfield(fieldNum( CustTable, Status9),true);
systablelookup.parmUseLookupValue(false);
systablelookup.parmQuery(query);
systablelookup.performFormLookup();


}

}

public void postBuild()
{
super();


if( this.controller() as jADController)
return;
DialogCity.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(JadcoReportBuilder ,citylookup), this);
}


public void build()
{
if(this.controller() as jADController)
return;
DialogContract = this.dataContractObject();

DialogCity = this.addDialogField (methodStr(JDCustomerInvoiceContract ,parmCity),DialogContract);
DialogCity = this.addDialogField (methodStr(JDCustomerInvoiceContract ,parmstatus),DialogContract);
DialogCity = this.addDialogField (methodStr(JDCustomerInvoiceContract ,parmRegion),DialogContract);
// DialogCity = this.addDialogField (methodStr(JDCustomerInvoiceContract ,)DialogContract);

// DialogCity = this.addDialogField (methodStr(JDCustomerInvoiceContract ,parmCity)DialogContract;


}


Controller class


class jADController extends SrsReportRunController
{
}


public static client void main(Args args)
{
jADController ff_ReportController;
ff_ReportController = new jADController();
ff_ReportController.parmArgs(args);
ff_ReportController.parmReportName(ssrsReportStr(JDCustomerInvoice1, Detail));
ff_ReportController. parmDialogCaption('Report');
ff_ReportController .startOperation();
}

}

Best Regards,

Shabir The type 'VarString' is not supported as a return value.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Unfortunately your code is difficult to read, because blocks of code aren't indented. Please make sure you always use Insert > Insert Code (in the rich-formatting view) to avoid this problem.

    Also, please tell us where the error is thrown from. It's a critical piece of information.

  • Verified answer
    Blue Wang Profile Picture
    on at

    Hi Shabir,

    In your contract class, you defined  City, Status, Region as str type.

    class JDCustomerInvoiceContract
    {
       TransDate Todate, FromDate;
       str City;
       str Status;
       str Region;
    }
    
    
    [DataMemberAttribute("City"),
       SysOperationLabelAttribute("City")]
    public str parmCity(str _city = city)
    {
       city= _city;
       return City;
    }

    You can try to change them to other EDT.

    I think error is from there, Have you debugged code?

  • Shabir Ahmad Profile Picture
    3,110 on at

    Hi Blue Wang,

    You were right i change to  EDT error gone, if you can support me more, here in our organization  they made custom fields City, Status and Region  on cuttable as string all, i want to show as drop down list parameter if you show me in code as report parameter, drop down list. Appreciating your suggestion dear.

    Best Regards,

    Shabir Ahmad

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    I think the best solution would be fixing this bug in data model, migrating the data and throwing away these incorrect fields.

    Use LogisticsAddressCityRecId EDT to refer to a city, because cities are stored in LogisticsAddressCity table. When you drop this EDT to a table, it should automatically create a foreign key reference and when you drop the field to a form design, it'll use  a reference group control. There you can choose which fields you want to replace RecId in GUI. You'll also get the standard lookup without any development.

    By the way, each city is already bound to a country (Name is not unique, RecId is).

    It seems we're now discussing the same things in two threads of your (the other is The value xxxxx in field 'City' is not found in the related table 'Cities'.). :-(

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans