Jump to content
Salesforce and other SMB Solutions are coming soon. ×

humphries
 Share

Recommended Posts

Hi! I am working on a simple a fitness program with Parent Table (PROGRESS CHART) related to TOs of CLIENTS, DAILY LOG, & MEASUREMENTS.

 

In my main table I have portals for each of these TOs (as if they were line items) on separate tabs so you can scroll through each client and see all of their history for each table of information.

 

Question 1: Every 10 days on the the measurements portal, I enter several fields of inches (waist, hips, etc) and then see total inches on the same line.

 

I would like to run a script or calculation to tally the inches lost over the last 10 days (the previous row) and the first time the measurements were taken (ie, total inches lost).

 

Question 2: On the Daily Log portal I enter daily weight, calories, and grams of fats, proteins, and carbs. Often for several days in a row these numbers will be the same.

 

To keep it simple I'd like to run a script to Duplicate Row Data (without duplicating the primary key) and then just change values that need changing. Further, I'd like to calculate weight lost every 10 days (every 10 entries) and total weight lost like in question 1.

 

Drawing a blank here - any help is appreciated!

 

Thanks!

Link to comment
Share on other sites

for Question 1 (and also the latter part of Question 2):

 

Set Variable [$Row; get(ActivePortalRowNumber)]

Go to Portal Row [first, no dialog, don't bother selecting anything]

Set Variable [$OriginalTtlInches; Measurements::Total Inches]

Go to Portal Row [by calculated value, no dialog, $Row-1, don't select anything here either]

Set Variable [$PrevTtlinches; Measurements::Total Inches]

Go to Portal Row [by calculated value, no dialog, $Row, don't select anything here either ]

 

you're now back on the row you just created. Is this where you want values to be deposited for inches lost since previous row and inches lost since the first time measurements were taken?

 

Set Field [Measurements::Loss Since Prev; Measurements::total Inches - $PrevTtlInches]

Set Field [Measurements::Loss Since Beginning; Measurements::total Inches - $ OriginalTtlInhes]

 

 

same logic for question 2's latter portion except instead of snagging a single value, Total Inches, I gather that you want to snag weight, calories, etc etc, several different values. Just set a different $variable for each one and then subtract current record value from the $variable to get amount lost.

 

 

 

for Question 2 (first part)

 

 

This one's easy:

 

 

Go to Related Records [Daily Log, in a new window "Duplicate me", show only related, of current record only, using layout "appropriate Daily Log layout"]

Duplicate Record/Request

Close Window ["Duplicate Me"]

 

 

the duplicate rec should appear immediately below the original. Change whatever you wish to change, the other field values remaining as they were.

Link to comment
Share on other sites

Thanks so much! This works...sort of. One thing I forgot to mention, my dates are sorted in descending order, so the newest record is on top. So if I reverse the script step to say Go to Portal Row [Last] (instead of first) to set my $OriginalInches, it grabs the Zero value from the empty portal row. How can I say "Go to Last Row - 1"?

 

Works perfect for everything else!

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use