Back to forum list… Back to How Do I?...

LOOKUP Failing (4 replies)

Arline Welty
5 years ago
Arline Welty 5 years ago

Goal:

Return a list of all the orders from a Lookup where there is a match on the CUSTOMER field in my IMAN map transform

Error when doing a map transform for a new field, ORDNUMBER:

Line=1;Pos=19; Syntax Error. Unexpected [“].
 

Lookup in Map Transform:

Lookup("VALIDORD", “ORDNUMBER”, Array(%[CUSTOMER], true)

Lookup in Setup:

See image attached.

 

  1. Is the way I have this set up incorrect?
  2. I want to return multiple ORDNUMBER values here for a single CUSTOMER. Is that a problem, eg, should I even be using Lookup to accomplish this?

Thanks for any advice.

 

https://www.realisable.co.uk/wp-content/uploads/2019/04/ImanLookup.jpg
Support
5 years ago
Support 5 years ago

Arline....

  1. Change the Where clause in the lookup to.

    CUSTOMER = '%1'

    See this link for more details on how the parameters are passed from the Lookup function to the SQL query.

  2. You cannot return multiple records from a Lookup. You will get an error. If you need to get a list of values you need to do some trickery with your SQL to get the list.

    Here's a link to a document explaining how you can do this. Preferred option is #1 assuming you're not targeting a SQL2017 database.

    https://www.mytecbits.com/microsoft/sql-server/concatenate-multiple-rows-into-single-string

https://www.realisable.co.uk/wp-content/uploads/2019/04/LookupSQL.png
https://www.realisable.co.uk/wp-content/uploads/2019/04/LookupSetup.png
Support
5 years ago
Support 5 years ago

Also, your syntax for the lookup is incorrect.

Just use the following...

Lookup("VALIDORD", “ORDNUMBER”, %CUSTOMER, true)

Arline Welty
5 years ago
Arline Welty 5 years ago

Thanks for the suggestions. Actually I was getting errors with that syntax as well, so I changed to the Array.

Thanks for the ideas on the lookup workarounds. Just wondering...should I being instead using Hierarchy transform? I could try to reverse what I'm doing, and return a big result set of orders first, THEN sum them up, instead of doing it the other way around. Is there a best practice?

Support
5 years ago
Support 5 years ago

Arline, I am not sure what you're trying to achieve, so difficult to say.

A hierarchy will work.

Contact

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Request Demo

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Access Downloads

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close