Column 'Number01' does not belong to table Company

Thanks for the suggestion. I’ve definitely thought of doing exactly this but I want to get through this uplift first. :slight_smile:

Calvin,
I didn’t need to. It already exists from the upgrade.
image

And yet it doesn’t show up as a field in the BAQ designer?
(Note that the UD fields appear at the very end of the field list).

Is that field on a customized version of Company config?

If so, is the binding okay?

If not, try adding a textbox and binding it to that field.

1 Like

It does in the BAQ designer. This is what is generating the error. It is from the Next Part button in Part Entry.
Private Sub epiButtonC1_Click(ByVal sender As Object, ByVal args As System.EventArgs)
’ ** Place Event Handling Code Here **
Dim compAdapt As CompanyAdapter = new CompanyAdapter(PartForm)
compAdapt.BOConnect()
Dim newPartID As Decimal = compAdapt.CompanyData.Tables(“Company_UD”).Rows(0)(“Number01”)
Dim newPart As String = newPartID.ToString(“0.00”)
Dim txtKeyField as EpiTextBox = CType(csm.GetNativeControlReference(“38e1671b-0c3f-4ab3-b8ab-95f26285f1d2”), Ice.Lib.Framework.EpiTextBox)
txtKeyField.text = newPart
txtKeyField.Focus()

	  newPartID = newPartID + .01
      compAdapt.CompanyData.Tables("Company_UD").Rows(0).BeginEdit()
      compAdapt.CompanyData.Tables("Company_UD").Rows(0)("Number01") = newPartID
      compAdapt.CompanyData.Tables("Company_UD").Rows(0).EndEdit()
      compAdapt.Update()
      compAdapt.Dispose()

End Sub

Did you look at

And further down that same thread …

Yes. I tried that too. Added it to SysCompany, regenerated and restarted the app pool. No luck.

Does the form show the value that is in Number01, before you try to change it with the button_click function? (just trying to see if the form andn its data view are seeing it)

Can yoiu manually change the value and save the form? Does the new value get saved, and is displayed the next time the form is loaded?

Calvin,

I don’t have Company bound to the part form. But I also do not in E9 and it works just fine.

Customize the Company Config form, adding a text box bound to that Company field.

This is just to see if DB table is accessible and getting updated when changed.

Also, I strongly suggest you start using C# in customizations - even if it means recreating ones that were ported from E9, but were in VB.

edit:

just noticed you have

Dim newPartID As Decimal = compAdapt.CompanyData.Tables(“Company_UD”).Rows(0)(“Number01”)

Number01 is an integer, no?

Calvin,

That is the plan but after I go live. In a time crunch now.
It is being stored as a decimal. See below. Also, I can edit and save the value in an updatable BAQ with no issues.

image

Have you tried commenting out parts of yopur code to determine if its the initail fetch, vs the update?

Private Sub epiButtonC1_Click(ByVal sender As Object, ByVal args As System.EventArgs)
' ** Place Event Handling Code Here **
Dim compAdapt As CompanyAdapter = new CompanyAdapter(PartForm)
compAdapt.BOConnect()
Dim newPartID As Decimal = compAdapt.CompanyData.Tables("Company_UD").Rows(0)("Number01")
Dim newPart As String = newPartID.ToString("0.00")
Dim txtKeyField as EpiTextBox = CType(csm.GetNativeControlReference("38e1671b-0c3f-4ab3-b8ab-95f26285f1d2"), Ice.Lib.Framework.EpiTextBox)
txtKeyField.text = newPart
txtKeyField.Focus()
newPartID = newPartID + .01
'compAdapt.CompanyData.Tables("Company_UD").Rows(0).BeginEdit()
'compAdapt.CompanyData.Tables("Company_UD").Rows(0)("Number01") = newPartID
'compAdapt.CompanyData.Tables("Company_UD").Rows(0).EndEdit()
'compAdapt.Update()
compAdapt.Dispose()

End Sub

Calvin,
Now I get “There is no row at position 0.”

Ditch the ud column use the Ice sequence class on the BPM side Part GetNew post proc

var nextPartNum = new Ice.Lib.NextValue(Db).GetNextSequence("PartNumSeq").ToString("00000")

The to string can be any string format you want. we prefer leading 0’s that’s all

So it must not like

Dim newPartID As Decimal = compAdapt.CompanyData.Tables("Company_UD").Rows(0)("Number01")

I’m just guessing, but do you get the same for the following:

Dim newPartID As Decimal = compAdapt.CompanyData.Tables("Company").Rows(0)("Number01")

(note I removed the _UD)

This gives error There is no row at position 0.

This gives the error Column Number01 does not belong to table Company

@SimpsonGranco - The following appears to work

	Private Sub epiButtonC1_Click(ByVal sender As Object, ByVal args As System.EventArgs)
		' ** Place Event Handling Code Here **
		
		Dim compAdapt As CompanyAdapter = new CompanyAdapter(PartForm)
		
		compAdapt.BOConnect()
		Dim compID as string = "MC"
		Dim compAd as Boolean = compAdapt.GetByID(compID)
		Dim newPartID As Decimal = compAdapt.CompanyData.Tables("Company").Rows(0)("Number01")
		Dim txtKeyField as EpiTextBox = CType(csm.GetNativeControlReference("a307d604-2dda-4c3a-b726-72569d4ba244"), Ice.Lib.Framework.EpiTextBox)
		txtKeyField.text = NewPartID.ToString
		txtKeyField.Focus()
		newPartID = newPartID + 0.01
		compAdapt.CompanyData.Tables("Company").Rows(0).BeginEdit()
		compAdapt.CompanyData.Tables("Company").Rows(0)("Number01") = newPartID
		compAdapt.CompanyData.Tables("Company").Rows(0).EndEdit()
		compAdapt.Update()
		compAdapt.Dispose()
	End Sub

(modify the compID and textbox GUID to match yours)

Not exactly sure why

Dim compAd as Boolean = compAdapt.GetByID(compID)

is now needed, when it wasn’t in E9.

Without that line, I get the “There is no row at postion 0.” error

That’s a lot of code vs just getting the next part number from Ice. Use the tools Epicor provides us we don’t have to do it the old E9 ways. I can literally be one line in a set field widget in a BPM.

4 Likes

Agree 100% with @jgiese.wci

If you are upgrading to 10 do it the right way
See:

1 Like

I also agree. The OP said that he was in a crunch and just needed to get his existing code working, and would implement a better way whe time allows.

1 Like

Well, I figured it out. Wasn’t the code at all. The upgrade adds in the Ice Company assembly references along with the Erp Company assembly references. I needed to remove the Ice ones and all is working perfectly.

Thanks,
Chris