Long chain of elseif statements as a last resort.
If you can use an array for this, go for it. It depends on the kind of information you have.
Beware though: Arrays have a size of 8192 at most (They are allocated dynamically in a logarithmic fashion)
If arrays won't cut it, use a hashtable.
You might be able to use an array even if your integers exceed 8192 by subtracting something like 'I000' for item ids (assuming you're going with the default raw codes generated by the Object Editor).
For unit raw codes, it gets a bit more complicated, so I'd suggest just using a simple hashtable in that case.