Forum Discussion

RubyKapil2's avatar
RubyKapil2
Qrew Captain
8 years ago

Copy all data from one field into another field within the same table

Trying to create a key field in a table that has not unique ID. Thought I could create a Formula-Text field to combine Lat and Long. Then copy this combined value into a new field and use the new field as a Key field.
  • Key fields must be unique. I can't reconcile your title with the body of your message - they seem  to be talking about different issues. Clarify.
  • Reason I am copying is so I can use the new field I copied into as a key field.
  • Ruby,

    In fact the best solition for your lat/ long issue is to make a formula field to concatenate the lat/ long together like 123-456. I think you have that already done.

    In fact, a little known secret is that a formula in fact can be the Key field to a table. You just need to type in the API call by hand into your browser.

    Just get to the table and after the ? Hand type

    act=API_SetKeyField&fid=99

    When 99 is the field ID number.

    You can double check the syntax in the API help guide, but I think that is it. I would turn off App tokens when you do that or else you would need to supply one to make that change

    Then you don�t need form rules to copy across a formula to a text key field!
  • I will try it. Thanks.
    I didn't concatenate because I was worried at some point the combined value would no longer be unique. How many decimal places to strip off? I have the entire Long and Lat value in there separated by a space using the List function. Reason I used space and did not use another symbol like  - or / is when I exported to CSV, then I noticed it changed the value of the combined data to some single value (like it was doing a calculation).
  • I can't really suggest if you would want to strip off decimals.  It's a text field, so text is text it will not truncate or round) and they will be unique if they are even a tiny bit different. I guess it depends on your application needs as to how many decimals to maintain.
  • You are brilliant! Thanks.

    Steps I took:
    App settings: App Properties>Security>I clicked on Manage tokens but no tokens listed. Then I unchecked the box Require Application Tokens.
    At the table I typed in act=API_SetKeyField&fid=33 after the ? and removed the "a=td" but got an error so I changed act= to a=

    It worked! I looked in my Table, that field has been set to be the Key field.

    Do I need to worry about the security concern from not requiring app tokens?
  • The only reason I suggested to turn off App Tokens was so that when you hand typed that URL once, you didn't not have to also  type &appoken= xxxhedqkurfkhndjdksk

    Feel free to turn to back on now that the Key field is changed. 

    I hesitate to advise on this forum whether you should or should not leave them enabled.  It is an extra layer of security.
  • Thank you once again for the solid advice. Your experience carries a great deal of weight. I will turn it back on.