Skip to main content
Question

GI Field conversion errors

  • September 3, 2026
  • 3 replies
  • 31 views

I am working on a formula in a GI:

IIf(CROpportunityProducts.InventoryID = ‘NON-INVENTORY ITEM’, CROpportunityProducts.Descr,CROpportunityProducts.InventoryID)

I’m getting an error because InventoryID field is int type and the Descr field type is nvarchar(256)

I’ve tried several of the conversion formulas (CInt) but I can’t get it to work.

Any advice?

3 replies

Forum|alt.badge.img+1
  • Varsity II
  • September 3, 2026

Someone may have a better solution, but I found that if you link to the IN.InventoryItem table and use that in the formula, it works.  See the attached xml. 

 

=IIf( [InventoryItem.InventoryCD]= 'NON-INVENTORY ITEM', [CROpportunityProducts.Descr], [InventoryItem.InventoryCD])


  • Author
  • Freshman I
  • September 3, 2026

Thank you!


Steve Milner
Varsity III
Forum|alt.badge.img+2
  • Varsity III
  • September 3, 2026

@koboldinst kmuczynski's fix is the right one. Worth knowing why, so it doesn't catch you again.

There's nothing to convert. CROpportunityProducts.InventoryID really is an integer column in the database, holding InventoryItem's internal key. The item code you see in that GI column isn't the stored value. The column renders through the item selector, which substitutes InventoryCD for display. Formulas get the stored value, so CInt or CStr just hands you the internal number, never 'NON-INVENTORY ITEM'.

It works the same way for CustomerID, VendorID, SiteID and the rest. The code a user actually reads sits on the parent record, so you join to it. The join isn't a workaround, it's the answer.

One detail worth keeping from that XML: the relation is a Left join. InventoryID is nullable on opportunity product lines, so an Inner join would quietly drop every line that has no item on it.

This came up here a few years back on a PO line if a second example helps: https://community.acumatica.com/reports-and-generic-inquires-115/using-an-inventory-id-in-results-gi-formula-15594