Role21 Posted November 29, 2018 Report Share Posted November 29, 2018 I'm having a problem with my formula. I want to generate an sub-ID. I am trying to create a formula wherein I put '2018' + school ID + section ID. Here is the formula I created but not producing a correct result. '2018'+ (SELECT school_ID FROM Profiles WHERE account_ID=[@field:account_ID])+(SELECT section_ID FROM Profiles WHERE account_ID=[@field:account_ID]) Please advise Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted November 29, 2018 Report Share Posted November 29, 2018 Hi @Role21, I understand that you want to generate a Sub-ID by concatenating some of your fields. May I please verify if how are you going to generate the sub-ID, is it via formula field on your table or via DataPage? Also, may I ask if what DataTypes you used on your School_ID and Section_ID fields. Regards, kristina Quote Link to comment Share on other sites More sharing options...
0 Role21 Posted November 30, 2018 Author Report Share Posted November 30, 2018 I am doing it on a Calculated Field. And I am using Integers as my data types. Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted November 30, 2018 Report Share Posted November 30, 2018 Hi @Role21, Thank you for your response. You can concatenate fields using this formula. You need to convert the DataTypes of your fields to varchar using CAST function. You can refer to this link: https://howto.caspio.com/function-reference/ Hope this helps, Regards, kristina Role21 1 Quote Link to comment Share on other sites More sharing options...
0 JolliBeng Posted November 30, 2018 Report Share Posted November 30, 2018 Hi Role21, Kristina is correct, you need to use "CAST" in your formula so you can convert your Data Type as a VARCHAR. If you do not convert that, the Data Types are still Integer, so the values add up. -JolliBeng Role21 1 Quote Link to comment Share on other sites More sharing options...
0 DefinitelyNot31337 Posted December 18, 2018 Report Share Posted December 18, 2018 Hello, We can also use the CONVERT function which functions exactly the same but with different syntax. In this case: '2018' + CONVERT(VARCHAR, [@field:School_ID]) + CONVERT(VARCHAR, [@field:Section_ID]) More information about function reference and Calculated Fields in these links: https://howto.caspio.com/function-reference/ https://howto.caspio.com/datapages/reports/advanced-reporting/calculations-in-forms-and-reports/ Regards, DN31337 Quote Link to comment Share on other sites More sharing options...
Question
Role21
I'm having a problem with my formula. I want to generate an sub-ID. I am trying to create a formula wherein I put '2018' + school ID + section ID.
Here is the formula I created but not producing a correct result.
'2018'+ (SELECT school_ID FROM Profiles WHERE account_ID=[@field:account_ID])+(SELECT section_ID FROM Profiles WHERE account_ID=[@field:account_ID])
Please advise
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.