Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

I work in a laboratory and am trying to edit the a script so that info will be copied and pasted from "time scheduled" to a "study history" section, meaning that while we will constantly be updating the "time scheduled" periodically, we want to maintain the "study history" info, and only paste into a new box (i.e. if Study 1 info is full, then it will paste into Study 2 info; if Study 2 info is full, then it will paste into Study 3 info, etc). I have managed to succeed up to pasting Study 2, but when I try to create the script for updating Study 3 info, it will also replace the Study 2 info.

Currently, my script has IF and ELSE IF for study 1 and 2, but I'm not sure how to edit the rest of the script.

Apologies if this is a bit verbose and confusing, but I'm not quite sure how to describe it otherwise!

Posted

1. We can't help you with your script if you don't show it. Post a copy of your script; or if possible, a copy or clone of the entire file.

2. Any time there are fields like Study1, Study2, This1, This2, etc it strongly suggests that the system isn't designed right. Generally there should NOT be fields named in this way; instead there should be related records. So please describe the system in more detail.

3. Copy/paste should be avoided in scripting. Use the set field script step.

  • Newbies
Posted

Hi,

Thanks for your fast response. I've attached a copy of my script.

Please let me know if you need anything else.

Thanks.

Script_copy.png

Screen_shot_2010-06-07_at_12.11.41_PM.png

Posted

It would be a good idea at this point to explain what you are really trying to do.

And you are definitely going to need to fix the design problem.

None of those fields (Study1, Study2, etc) should exist.

It looks like you're trying to create a history table; in which case, that is really what you should do (create a separate table).

This will allow you to create a portal which displays the history records.

But back to the original question: what is this solution about in general, what does the row of ages/dates represent, when is it updated and why?

Posted

Though you do need to fix the design and entirely change the scripts, it will also be helpful to understand the significant logic problems with the original script.

What does this really do?

If [ Case( isEmpty( kiddatabase::Study1); 2)]

Answer:

If Study1 is empty, return the value "2".

The statement actually becomes, when Study1 is empty:

If [2]

copy....

But actually even that is not quite true. In an "IF" statement, any positive number really means "true" which really means "1".

So the first line really says this:

If [1]

copy....

The Else If statement has a similar problem.

If Study1 is NOT empty, return the value "2"

So logically it looks like this when Study is not empty.

Else If [1]

The statement:

If [ Case( isEmpty( kiddatabase::Study2); 3)]

Else If [ Case( isEmpty( kiddatabase::Study2); 3)]

Really mean:

If [isEmpty( kiddatabase::Study2)]

Else If [ isEmpty( kiddatabase::Study2)]

But *ALL* of this would be avoided, and the entire if copy else if etc script would be eliminated by putting the values directly into the history table.

Posted

Hi,

Thanks for your fast response. I've attached a copy of my script.

Please let me know if you need anything else.

Thanks.

The screen shots really make it MUCH easier to answer questions; thanks for doing that. If you have trouble imagining how to set up the relationships, a clone of the file itself would helpful if you are comfortable providing it.

  • Newbies
Posted

On a side note- do you know how to update the current date? I'm trying to do calculations of subject age today in months and days, but what I get for the current date (by inputting "Get(CurrentDate)") is incorrect (it says 10/29/2009, when it is actually 6/8/2010).

Thanks!

Posted

Not enough information. Get( currentDate) is VERY reliable.

The result you describe is basically not possible; unless the clock on your computer isn't set right.

It would really be helpful to post a clone of your file and describe exactly where you're using this expression.

Posted

Great! Thank you so much! =)

So - you added a history table and a portal?

Posted

I'm trying to do calculations of subject age today in months and days,

Arrrgh, don't go there. It always ends in tears. A month can vary in length from 28 to 31 days, and it's a bugger working out what should be a month, and what should be a month+days

30 May to 30 June is 1 month... or 30 days?

30 May to 31 June is 1 month, or 1m1d, or 31 days?

31 May to 1 July is what?

Posted

but what I get for the current date (by inputting "Get(CurrentDate)") is incorrect (it says 10/29/2009, when it is actually 6/8/2010).

Hi BCDC,

Calculations using most Get() functions must be set to unstored (check 'do not store calculation results' in Storage Options). Get ( CurrentDate ) is the same ... it must always be unstored to keep the date current.

This topic is 5282 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
×
×
  • Create New...

Important Information

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