Since upgrading my apps from C8 to C11 I have one app that always generates these errors when building:
TPL: (PBDY.$$$) Error: ASSERT: Unique/primary key required on table StaffEntView with the STEV:AlphaName field as single or last component. Procedure: UpdateIncPerson - C:\Clarion_Projects\FutureIT C11\KLServers\PBDY.$$$:1
TPL: (PBDY.$$$) Error: ASSERT: Unique/primary key required on table IncPerson3 with the IPR3:AlphaName field as single or last component. Procedure: UpdateIncPerson - C:\Clarion_Projects\FutureIT C11\KLServers\PBDY.$$$:1
TPL: (PBDY.$$$) Error: ASSERT: Unique/primary key required on table StaffEntView with the STEV:AlphaName field as single or last component. Procedure: UpdateIncPerson - C:\Clarion_Projects\FutureIT C11\KLServers\PBDY.$$$:1
TPL: (PBDY.$$$) Error: ASSERT: Unique/primary key required on table IncPerson3 with the IPR3:AlphaName field as single or last component. Procedure: UpdateIncPerson - C:\Clarion_Projects\FutureIT C11\KLServers\PBDY.$$$:1
TPL: (PBDY.$$$) Error: ASSERT: Unique/primary key required on table IncPerson3 with the IPR3:AlphaName field as single or last component. Procedure: UpdateIncPerson - C:\Clarion_Projects\FutureIT C11\KLServers\PBDY.$$$:1
I can successfully build the app by pressing the ‘Rebuild Solution’ button and these errors disappear. This didn’t happen in C8 at all.
The ‘StaffEntView’ table is a MSSQL View. The ‘IncPerson3’ table is an alias of a MSSQL table.
Could anyone shed some light on how to fix this so I don’t have to keep building this app twice every time?
But this is a view that doesn’t need a primary key. I also have 2 other views that C11 isn’t complaining about in the same app that don’t have primary keys. Why is C11 complaining about this view and not the other 2?
Also the IncPerson3 table is not a view and DOES have a primary key. Why is C11 still complaining about it? The unique key for this table is not the IPR3:AlphaName field and I don’t want it to be.
The key is used by clarion to determine where it is and enable paging through the file. This is the case regardless of if it’s a view or a table. Clarion still needs to know where it is. The problem you will encounter is repeating lines in a paged browse.
I’m uncertain about the IPR3:AlphaName problem. You don’t provide quite enough info. But if all this is in browses you might be able to add a unique field to the additional sort fields to fix it.
So first things first. These are ASSERT’s, telling you something is wrong. They are Generator Asserts as evidenced by the TPL: part at the beginning.
So “compiling twice” serves no purpose. You get the ASSERTs when the app generates (the first time.) It still generates, just tells you these things are wrong. Then it compiles it. Compiling it again just skips the generate step. So feel free to not generate twice.
Always worth mentioning the context early, because context is everything when it comes to understanding errors.
In the UpdateIncPerson you are doing a lookup on the StaffEntView table, populating the STEV:AlphaName field. In that lookup field you have set it to “display description instead of value”. To use that feature you need to have a unique key on the description field. So add the key, or turn off the feature.
Rinse and repeat for the others.
That’s true for browses, but in this context he’s on a form, so it’s not the reason here.
When I remove ‘STEV:AlphaName’ from the ‘Description Field’ option and compile I get a ‘No matching prototype available’ error:
Loop
Next(IPR:FollowUpName_OptionView)
If ErrorCode() then Break.
recs += 1
packet.append(choose(recs=1,'',',') & '"' & p_web.JsonOK(p_web.AsciiToUtf()) & '"') !Error here on the p_web.AsciiToUtf()
If recs >= 20
Break
End
End
yes, because you need a Description field. But you are also using STEV:AlphaName for a Value field, so you need a unique key on that if you’re not using the description field. (If STEV:AlphaName is not unique then using it as a lookup value doesn’t seem to make much sense…)
Ok I understand it now. STEV:AlphaName is not unique so will need to change the description field to something unique, add a key on the description field and use the ‘Display description instead…’ feature.