question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MultiTenant Lookup editor - Input String incorrect format

See original GitHub issue

I’ve been playing around with this one and could use some outside help. I keep getting an “input string is in incorrect format” error. I cant seem to figure out the fix.

I’ve set up as a multitenant. I have a table which acts as my master table. At that table I have a TenantId that is defaulted to 1, thus only one tenant can see data in that table. I also have another ID, CustomerID, which I have joined to the TenantId from the tenants table. I use this so that I can use the CustomerID to designate the TenantId in the SqlViews thus, create reports which clients can only see the data pertaining to them. Those views work perfectly.

I created the following lookup script to deal with the search box:

[LookupScript(“FMCorp.MatrixCustomerName”)] public class MatrixCustomerNameLookup : MultiTenantRowLookupScript<MyRow> { Field fld = MyRow.Fields.CustomerName;

    public MatrixCustomerNameLookup()
    {
        IdField = TextField = fld.PropertyName;
    }

    protected override void PrepareQuery(SqlQuery query)
    {
        query.Distinct(true)
            .Select(fld)
            .Where(
                new Criteria(fld) != "" &
                new Criteria(fld).IsNotNull()
                );
        AddTenantFilter(query);
    }
    protected override void ApplyOrder(SqlQuery query) { }
}

Matrix row designates the fields affected like this:

[DisplayName(“Customer Id”), ForeignKey(“[dbo].Tenants”, “TenantId”), LeftJoin(“cust”), Width(100), AlignCenter] //Join TenantID from Tenant Table to Matrix Table. Identifier is “cust” [LookupEditor(“Administrative.Tenants”)]//Added for DropBox type Lookup public Int32? CustomerId { get { return Fields.CustomerId[this]; } set { Fields.CustomerId[this] = value; } } [DisplayName(“Customer Name”), Expression(“cust.TenantName”), Width(100), AlignCenter] //Calls upon Name column from Customer Table. [LookupEditor(typeof(Script.MatrixCustomerNameLookup))] public String CustomerName { get { return Fields.CustomerName[this]; } set { Fields.CustomerName[this] = value; } }

I then added the lookup script to the columns table for customer name but I also hid the CustomerId

. //Client and Location Information [Hidden] public Int32 CustomerId { get; set; } [EditLink, LookupEditor(typeof(Script.MatrixCustomerNameLookup)), QuickFilter]
public String CustomerName { get; set; }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Estruscocommented, Jun 30, 2016

Check the IdField = TextField = fld.PropertyName; where fld is MyRow.Fields.CustomerName. Second my opinion there is an error.

The IdField should be fld.CustomerId

0reactions
volkanceylancommented, Jul 7, 2016

Where is your query

Read more comments on GitHub >

github_iconTop Results From Across the Web

MultiTenant Lookup editor - Input String incorrect format #852
I keep getting an "input string is in incorrect format" error. I cant seem to figure out the fix. I've set up as...
Read more >
Input string was in incorrect format error when saving to ...
(I'm using linq to sql...) EDIT: It was because I didn't stop the method that populates the field on page load from executing...
Read more >
Display and Edit Simple Type Values in a Lookup Property ...
This help topic describes how to allow end users to select a property value of a simple type (string, integer, enumeration, and so...
Read more >
Article: NetSuite Integration Guide: Common Errors
This article contains a list of common errors related to NetSuite Integration. See also NetSuite Integration Guide. Error: NetSuite Import ...
Read more >
LOOKUP function - Progress Documentation
Returns an INTEGER value giving the position of an expression in a list. Returns a 0 if the expression is not in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found