Jump to content

How to convert a string to an integer


Recommended Posts

Hi, I am having an issue converting a string to an integer.  



    vendor.name as vendorname,
    part.num as partnum,
    part.description as partdesc,
    CAST(coalesce(crit.info,0) as Integer) as criticallevel,
    COALESCE(partreorder.reorderpoint,0) as ROP,
    COALESCE(partreorder.orderuptolevel,0) as OUL,
    cast(coalesce(qtyOnHand.qty,0) as Integer) - cast(coalesce(qtyAllocated.qty,0) as Integer) - cast(coalesce(qtynotavailable.qty, 0) as Integer) as "Qty Available",
    cast(coalesce(partreorder.orderupToLevel,0) as Integer) - cast(coalesce(qtyOnHand.qty,0) as Integer) - cast(coalesce(qtyallocated.qty,0) as Integer) - cast(coalesce(qtyNotAvailable.qty,0) as Integer) + cast(coalesce(qtyDropShip.qty,0) as Integer) + cast(coalesce(qtyOnOrder.qty,0) as Integer) as "To Order"
from part
      INNER JOIN vendorparts on vendorparts.partid = part.id
      INNER JOIN vendor on vendorparts.vendorid = vendor.id
      LEFT JOIN customset as ctpfg on ctpfg.recordid = part.id and ctpfg.customfieldid = 73
      LEFT JOIN customvarchar as crit on crit.recordid = part.id and crit.customfieldid = 38
      LEFT JOIN partreorder on partreorder.partid = part.id
      LEFT JOIN qtyonhand on qtyonhand.partid = part.id
      LEFT JOIN qtyallocated on qtyallocated.partid = part.id
    LEFT JOIN qtynotavailable on qtynotavailable.partid = part.id
    LEFT JOIN qtydropship on qtydropship.partid = part.id
    LEFT JOIN qtyonorder on qtyonorder.partid = part.id
where ctpfg.info = 'Book'
and coalesce(crit.info, 0) > coalesce(qtyOnOrder.qty,0) - coalesce(qtyAllocated.qty,0)
I have this code in the query section of IREPORT.  But in the condition section of the query it is telling me that (ERROR: SQL Problems:GDS Exception.  35544334. Conversion error from String "B".
I also tried cast(coalesce(qtyOnOrder.qty,0) as Integer) and it is still giving me an error.  I am not sure what to do in this case.  Someone's assistance would be greatly appreciated. Thank  you!
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...