Jump to content

Calculation on a Repeating Field and Putting Result into Specific Repetition


This topic is 2060 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've got a repeating field as a calculation and need to put a value into a specific repetition value/location, but I don't want to have to run a script every time to accomplish this.

 

For example, I have two fields, NumberField and RepeatingField[10]

 

When NumberField = 5 I need a 5 to show up in RepeatingField[5]  Can I do this in a calculation? If not, what's the best way to do this? This seems to trivial to me, but I'm looking for a elegant solution.

Link to post
Share on other sites

Ha! I figured that. I thought I'd try because I thought there would be a simple and quick way with a repeating field and one calculation. Otherwise, I've got to create 10 fields and 10calculations which all would need to be maintained and cluttering up the table.

Link to post
Share on other sites

 I've got to create 10 fields and 10calculations which all would need to be maintained and cluttering up the table.

 

If this is for developer use, there is nothing wrong with repeating fields - as long as it does not hold client data.  Can you explain the purpose here?  10 fields and 10 calculations indicates either 1) they should be records in a related table or 2) they are developer tools, doesn't it?

Link to post
Share on other sites

Sure thing...

 

I have a table of tasks each with a due date. In list view I have each task and adjacent to each task are twelve columns one for each month. I just want to highlight the corresponding repeating value which corresponds to the the month. 

 

if Month = 1 then put a value in the first repeating field..If month  = 2 then put a value in the 2nd repeating field..so on. I can then do conditional formatting to get the highlighting.. I've already worked this solution out with 12 fields and 12 calculations...looking for a simpler solution.

Link to post
Share on other sites

What value do you want it to have?  Well, try this:

 

Create a calculation with 12 repetitions and a calculation of:

Let ( [
i = Get ( CalculationRepetitionNumber ) ;
d = Extend ( date ) 
] ;
Case ( i = Month ( d ) ; i )
)

You should be able to replace the final result where I have i - to be whatever you wish.  As is, that repetition fills with the month number. Adjust as needed.

  • Like 1
Link to post
Share on other sites

What value do you want it to have?  Well, try this:

 

Create a calculation with 12 repetitions and a calculation of:

Let ( [
i = Get ( CalculationRepetitionNumber ) ;
d = Extend ( date ) 
] ;
Case ( i = Month ( d ) ; i )
)

You should be able to replace the final result where I have i - to be whatever you wish.  As is, that repetition fills with the month number. Adjust as needed.

This works. Thank you! Can you explain how this works? How does it put 'i' into repetition['i']?

Link to post
Share on other sites

I'm pleased it worked for you, GisMo.  I lost my post so I'm try again to explain ...

 

i - is just the repetition number

d - is your date extended the same to all repetitions

 

If each repetition number identified as i ( evaluated from itself ) looking across to the matching 'rep number' of the extended  date equals the month number of the date (in its matching rep) then produce the result of i which is assigned as the local variable within the Let() otherwise produce no result.

 

So for another month example, instead of this:

 

Case ( i = Month ( d ) ; i )

 

it could be this:

 

Case ( i = Month ( d ) ; MonthName ( d ) ) 

  • Like 1
Link to post
Share on other sites

This topic is 2060 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Similar Content

    • By Asu
      I know. Don't use them. But There is a simple task and a repeating field would be a quick solution.
      Field 1: a number
      Field 2: a calculated repeating field, each repetition adds the repetition number to the value of Field 1.
      Can it be done?
      Thanks
    • By ehwalker
      Ah, okay that makes sense! Thanks so much for all your advice.
      Okay, my next issue is as follows....
      So I have a layout for 'Tracking Sessions' which contains details of each time someone went out to find a particular individual/group of cheetahs. Within this layout, I have a Tab that contains different portals to different tables of information that could be (but not always) collected during a specific tracking session (e.g. kills found, supplemental feeding, and 'Tracking Notes'). Now, because of the Join table how can I set these portals up to allow for record creation in these child tables while also creating the necessary records for the join tables? I've included a screenshot of the layout. Everything under 'Kill Details' is contained within a single portal row, as there is usually only a single kill during a single tracking session (though I guess in theory there could be more than one at some point in the future). From my experience and what I've read, you can't place a portal within a portal so how do I solve this issue while maintaining the current format (or if there is a better way of doing this, I'm all ears!) I've also included an updated screenshot of my relationship table, so you can see where tracking sessions lies in relation to kills and cheetahs.
       


    • By ehwalker
      I'm working on a database to store/organise data pertaining to Radio/GPS collared cheetahs (e.g. movements, kills they've made, etc.). Within the database, my main table is 'Released Cheetahs' which contains all the information about an individual cheetah and their local ID number, which is called 'AJU#'. AJU# is the field relating 'Released Cheetahs' to the other main tables within the database (Fix Data, Kills, Tracking Sessions, Parturitions, Releases, Captures, etc.).
      Some of these cheetahs (and thus the records within 'Released Cheetahs') are in groups of a few individuals, which is delineated by 'Group Name'. My problem is that when I make a entry into one of the other tables, let's say 'Kills' (which contains info about the prey they have successfully hunted), with my current design I would need to duplicate this record for every cheetah within the group, but I would rather be able to just list all of the cheetahs (i.e. AJU#s) within a single field of the 'Kills' table so that there is only one entry per kill.
      So, my question: What would be the best way of tying each kill record (single 'child' record) back to each of the cheetahs (multiple 'parent' records) it pertains to? I know I could just look at this from cheetah group rather than individual, but even though there is a group each kill record does not always pertain to each cheetah within a given group. I have tried playing around with repeating fields (e.g. using a repeating AJU# field within the Kills table) but I can't quite seem to get this to work as hoped. Any advice is most welcome!
      I've attached an image of my relationship graph in case that helps.

    • By cat traveller
      Hi, 
      My setup is a portal displaying a repeating field. 
      This repeating field is an unstored calculation evaluating SCGetContainer (mypath ; id on SC).
      When my id value on SC is the first repetition of the field, SCGetContainer displays correctly. When I am using the second value, I get a blank display. 
      Is this something that can be done with the SCGetContainer Function?
       
      Thanks for everyones help.
      ole
    • By gerg nnud
      Now I know you are all going to say “don’t use repeating fields to store editable data!” but I am running into all sorts of other problems with my solution using a separate table of records that I thought it may just be that repeating fields could offer a solution.
       
      Contacts table with multiple addresses.
      Pop List for field AddressType based on editable custom value list - Address 1 street, Address 2 Postal, Address 3 Billing, Address 4 - Shipping, Address 5 Other …Edit to generate a dynamic relationship.
       
      The current solution uses a separate Contact_Addresses table and the dynamic relationship is based on a calculation field in Contacts - AddressTypeAbs = Abs(AddressType), which returns just the numeric value from the value list. A transparent portal then displays the related address fields on the Contacts layout. This is an elegant way to save space on the Contacts’ layout as only one address is displayed at any one time but unlimited addresses are possible.
       
      My problem is however that many other tables in my solution have a relationship to Contacts, e.g. Invoices, Purchases, Quotes, Personnel and on and on and on. So in order to display address details in these other tables each has to have another relationship to Contact_Adresses. The deeper it goes the more complex it gets with relationships, workaround scripts and key fields.
       
      I thought that maybe using repeating address fields in the Contacts table itself might simplify the database by drastically reducing the need for the extra relationships, key fields etc. but I cannot seem to find a way of achieving my goal to display each repletion in a portal.
       
      What would fit my needs perfectly would be to have say 10 repetitions of each of the address fields in the Contacts table itself. The relationship key AddressTypeAbs would remain the same but relate to the address fields’ repetition number. It doesn’t seem possible to relate to a repetition number but I might just have missed something. Just thought to post this before giving up entirely. Any thoughts?
  • Who Viewed the Topic

    13 members have viewed this topic:
    Pipm  Dirigo  amerioca  toolhead  Slater  Chip Demetri  moriya0238  JosephK  AlanTrewartha  Lowermountain  axon  -Queue-  Zach360Works 

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.