Forum Discussion
- QuickBaseCoachDQrew CaptainNo, the Key field must not be a formula.
An alternative is to have your form show the calculated formula and then have a Form Rule that says "when the record is saved, change the value of [my key field] to the value in he field [my key field formula]".
But then you will also probably want a safety net to subscribe to where the Key fields does not equal the formal field. - JuanSolorio1Qrew CadetThanks Mark. The issue is that ALL the records in this table will be imported rather than directly imputed via a form.
- QuickBaseCoachDQrew CaptainIf all the records are being imported, them import them with the Key field calculated.
If the source data is not flexible, then import to an Excel Template to add the calculated the Key field and then import to your app. - MindaMayQrew CadetI have a similar situation. In my case, I'm not using a form or importing the records. The records are created by the Copy Master Detail button... but I want a formula field to populate the key field when the records are created. Any ideas?
- BrianCafferelliQuickbase StaffHi Minda, you could use the method Mark suggested above, but using an automation rather than a form rule. So the automation will listen for new records to be created and move the field value from your formula - text field to a non-formula text field. That way it will work with your Copy Master and Detail Records button.
The reason why you generally cannot set a formula as a key field, by the way, is that every record needs to have a unique value for the key field, but the value of a formula field can change at any time.
- QuickBaseCoachDQrew CaptainThere is an API to set the key field which can simply be hand typed into the URL address bar. It does allow for a formula field to be the Key field.
But you would be in somewhat uncharted territory as I�ve never seen any documentation that this is OK to do. I was just told about it an an EMPOWER breakout session.
You would have to make a copy of your app to test that. - LauraThackerQrew CaptainI have done this on many occasions and use the API in the URL bar to set this.
?a=API_SetKeyField&fid=X&apptoken=catjbq7277cyecb3vh95zdqgi5- AnkitPruthi1Qrew MemberDo I need to create a new filed (Formula Url) to do this?
------------------------------
Ankit Pruthi
------------------------------- MarkShnier__You
Qrew Legend
They recently blocked doing the API to change a table's Key field to be a formula field as it was unreliable and led to weird buggy behavior.
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
markshnier2@gmail.com
------------------------------
- RussellLaneQuickbase StaffHey folks - thanks so much for your question, and for the comments and answers! We noticed the discrepancy between the UI and the API around this issue, and had some concern about possible data integrity issues resulting from that. Data integrity is a critical issue to us, so we've made a change that will make the API behave the same as the UI - it will no longer be possible to set formula fields as keys via the API. That should appear in an upcoming release.
- QuickBaseCoachDQrew CaptainRussel,
Thx for that clarification. I used to use that technique, but then ran into "bugs"where I had records with duplicate key fields. Given that this was an undocumented feature, I reverted back to a traditional Key field. - DrewVogeQrew Cadetwill the change in the API behavior in any way affect existing tables where the key was established in this manner?
- hherschQuickbase StaffHi Drew - it will not. But having a formula key field has the potential to cause inaccurate data.