You are viewing limited content. For full access, please sign in.

Question

Question

Lookup fails when string contains periods, hyphens, etc.

asked on March 27, 2020

Our source data contains periods, such as 2230.1500.1000, which are stored as a string.  Lookups in Forms don't seem with work with these values.  Is there a way around this?

 

0 0

Answer

SELECTED ANSWER
replied on March 30, 2020

That is expected behavior for nchar (the value is padded with spaces to the length of the field.

I would guess that is the problem here, the values are padded with spaces that are trimmed on the Forms side, so they're no longer matching.

2 0

Replies

replied on March 27, 2020

I can still make it work in a table. And I made the description field read-only so no one could change it and it still worked.

 

Rule Out Troubleshooting - 

Have you tried to fill the field with a different column from the table just to rule out any issues with the AcctDesc column specifically?

Have you looked at the SQL table and confirmed that there is indeed information in the AcctDesc column?

Have you attempted to do a lookup and populate field with any other SQL table just to rule out any issues with the GL table?

Have you tried using fields not in a table to see if it will populate the description just to rule out any issues with the Laserfiche table?

SQL Lookup.jpg
SQL Lookup.jpg (31.68 KB)
1 0
replied on March 30, 2020

Does your table use a nvarchar column for this?

0 0
replied on March 27, 2020

Is the lookup filling a number field or single line field? It should fill the single line field with those values. 

6.8.0
0 0
replied on March 27, 2020 Show version history

There is a drop-down list with the strings in question.  When the user selects a value from that list I want to do a Lookup to fill a single-line field with related Description field from data source.

0 0
replied on March 27, 2020

Can you post a screenshot of your lookup rules?  I can set up a lookup with periods and it works fine.

0 0
replied on March 27, 2020

Screen shot of form with table.  Lookup rule should fill Description when account is selected.

Lookup Rules:

0 0
replied on March 30, 2020

Here's a sample from SQL Server:

 

 

Both are nchar fields.  The GLAcct field is populated in the SQL Server table using the Concat function - CONCAT(BusUnit,'.',ObjAcct,'.',SubAcct)

 

I also tried this without the table and it still doesn't work.  I am also having difficulty in SQL Server just querying the same conditions and getting no results.  Perhaps it has something to do with the fields being nchar?  I haven't tried this before with the concatenation of periods to separate multiple fields so it's kind of a mystery at this point.

 

 

 

0 0
replied on March 30, 2020

Do all values fail or just the ones that are missing the last group of digits?

0 0
replied on March 30, 2020

All values fail.

0 0
replied on March 30, 2020

What is the length of that column?

0 0
replied on March 30, 2020

When I recreate the table in SQL with the fields being used in the concat statement being nchar, the drop-down list on the form will not even populate.  When I recreate the SQL table with the fields being used in the concat statement being int, the drop-down populates and the lookup rule fills the description field on the form.

replied on March 30, 2020

I believe Miruna is asking what length the nchar columns that feed the concat statement are.  When I recreate the table as nchar, I made them nchar(10) and that set a fixed value of 10 characters so my concat field does not look as expected.

 

ncharvalues.jpg
ncharvalues.jpg (22.28 KB)
1 0
SELECTED ANSWER
replied on March 30, 2020

That is expected behavior for nchar (the value is padded with spaces to the length of the field.

I would guess that is the problem here, the values are padded with spaces that are trimmed on the Forms side, so they're no longer matching.

2 0
replied on March 30, 2020

Miruna; you are correct.  If I add LTRIM(RTRIM) to the fields before concatenating, the unseen spaces are removed and the lookups now work.  Thanks.

 

2 0
replied on March 30, 2020

Here's the table in SQL Server.  It gets created from a SELECT INTO statement and the field data types are generated automatically.

 

SELECT 
    CONCAT(GMMCU,'.',GMOBJ,'.',GMSUB) as GLAcct,
    GMMCU as BusUnit,
    GMOBJ as ObjAcct,
    GMSUB as SubAcct,
    GMDL01 as AcctDesc
Into GLAccounts
FROM 
    ROMAINE.ROMAINE.PD920DTA.F0901

0 0
replied on March 30, 2020

What are the data types in the source table ( ROMAINE.ROMAINE.PD920DTA.F0901 )?

0 0
replied on March 30, 2020

All columns are data type GRAPHIC.

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.