Solved

2 fields from different forms - one calculated - in 1 view? HemanthaKumar

Posted on 2004-03-30
9
217 Views
Last Modified: 2013-12-18
Hello,

I have 2 different forms (lets call em formA and formB), formA has a field name 'datecomplete' formB has a field named 'edcomplete'. Both are date fields.

I need to display the date in a view - if the form is A then I just need to display the date in the 'datecomplete' field. If the the form is B I need to display 'edcomplete' + 10 WORKING days in the view.

I tryed something along the lines of:

@IF(form = "FormA"; datecomplete; form = "FormB"; @Adjust(edcomplete; 0; 0; 10; 0; 0; 0;); "Unknown")

But that doesnt seem to work and cant account for working days (no weekends).

Using Notes R5...Since qwaletee snagged the points earlier and this question is based on a proposed answer from HemanthaKumar, I'm looking in his direction for a solution - but will take anything that works.

Thanks in advance!
-jim
0
Comment
Question by:yim11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
9 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10718046
You have to work on number of working days .. What is this based on ?

~Hemanth
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10718103
ok I get it now...


futuredates := @Adjust(edcomplete; 0; 0; 10; 0; 0; 0);
t := @Explode(@TextToTime(@Text(edcomplete) + "-" + @Text(futuredates)) );
weekdays := @Replace( @Text(@Weekday(@TextToTime(t) )); "1" : "7"; "");
concat := weekdays + t;
dts := @Right(@Replace( concat; t; ""); @Length(concat) -1 )

@IF(form = "FormA"; datecomplete; form = "FormB";dts; "Unknown" )

THis should work for you...
0
 

Author Comment

by:yim11
ID: 10718123
Its a development datebase, one office uses formA (and has a date complete field) another office uses formB (but I have to calculate date complete). I have code that works for working days [see below] but not sure how to integrate it.

Let me know what other info I need to provide.

Thanks,
-jim

---code---

temp := (@Date(EDComplete) - @Date(DateToED)) / 86400;

weekend_days := @Integer((temp / 7)) * 2;

wkday := @Weekday(DateToED);

adjust := @If(((wkday + @Modulo(temp; 7) - 7) > 0); 2; 0);

working_days := temp - (weekend_days + adjust) +1;

@If(EDComplete = ""; 0; working_days)

---EndCode--
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10718171
or more appropriately,

futuredates := @Adjust(edcomplete; 0; 0; 15; 0; 0; 0);
t := @Explode(@TextToTime(@Text(edcomplete) + "-" + @Text(futuredates)) );
weekdays := @Replace( @Text(@Weekday(@TextToTime(t) )); "1" : "7"; "");
concat := weekdays + t;
dts := @Subset( @Trim(@Right(@Replace( concat; t; ""); @Length(concat) -1 )); 10);

@IF(form = "FormA"; datecomplete; form = "FormB";dts; "Unknown" )
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10718249
Then try this

@if(form = "FormA"; datecomplete; Form = "FormB"; ""; @Return("Unknown"));

temp := (@Date(EDComplete) - @Date(DateToED)) / 86400;
weekend_days := @Integer((temp / 7)) * 2;
wkday := @Weekday(DateToED);
adjust := @If(((wkday + @Modulo(temp; 7) - 7) > 0); 2; 0);
working_days := temp - (weekend_days + adjust) +1;
@If(EDComplete = ""; 0; working_days)
0
 

Author Comment

by:yim11
ID: 10718407
This code:
---
futuredates := @Adjust(edcomplete; 0; 0; 15; 0; 0; 0);
t := @Explode(@TextToTime(@Text(edcomplete) + "-" + @Text(futuredates)) );
weekdays := @Replace( @Text(@Weekday(@TextToTime(t) )); "1" : "7"; "");
concat := weekdays + t;
dts := @Subset( @Trim(@Right(@Replace( concat; t; ""); @Length(concat) -1 )); 10);

@IF(form = "FormA"; datecomplete; form = "FormB";dts; "Unknown" )
---
Marks all entries in the view as Unknown.

The other code:
---
@if(form = "FormA"; datecomplete; Form = "FormB"; ""; @Return("Unknown"));

temp := (@Date(EDComplete) - @Date(DateToED)) / 86400;
weekend_days := @Integer((temp / 7)) * 2;
wkday := @Weekday(DateToED);
adjust := @If(((wkday + @Modulo(temp; 7) - 7) > 0); 2; 0);
working_days := temp - (weekend_days + adjust) +1;
@If(EDComplete = ""; 0; working_days)
---
Empties the view, all entries are gone.

So I'm thinking that we may need to tweak the first code some<?>

Here is the EXACT code I used (changed var and form names to actual names being used):
---
futuredates := @Adjust(DatetoED; 0; 0; 15; 0; 0; 0);
t := @Explode(@TextToTime(@Text(DatetoED) + "-" + @Text(futuredates)) );
weekdays := @Replace( @Text(@Weekday(@TextToTime(t) )); "1" : "7"; "");
concat := weekdays + t;
dts := @Subset( @Trim(@Right(@Replace( concat; t; ""); @Length(concat) -1 )); 10);

@IF(form = "Sample Login"; DateDue; form = "AAEDFORM";dts; "Unknown" )
---
I think the above code may be easier to work with since in most cases EdComplete field will be blank.

What information do you need from me at this point?

Thanks!
-jim
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 200 total points
ID: 10718922
My first formula gives list of 10 business dates from the DatetoED.. Is this what you want or do you want the 10th business day from the datetoED ?

Both can be done from the formula that I gave.. But it giving 10 "unknown" values is something that I din't expect.

We have to modify the formula so that unnecessarily we don't calculate the date calculation

@IF(form = "Sample Login"; @Return(DateDue); form = "AAEDFORM"; PERFORMBELOWCALC ; @Return("Unknown") );
futuredates := @Adjust(DatetoED; 0; 0; 15; 0; 0; 0);
t := @Explode(@TextToTime(@Text(DatetoED) + "-" + @Text(futuredates)) );
weekdays := @Replace( @Text(@Weekday(@TextToTime(t) )); "1" : "7"; "");
concat := weekdays + t;
dts := @Subset( @Trim(@Right(@Replace( concat; t; ""); @Length(concat) -1 )); 10);
dts

If you don't want 10 business days but 10th business day, just use this

@IF(form = "Sample Login"; @Return(DateDue); form = "AAEDFORM"; PERFORMBELOWCALC ; @Return("Unknown") );
futuredates := @Adjust(DatetoED; 0; 0; 15; 0; 0; 0);
t := @Explode(@TextToTime(@Text(DatetoED) + "-" + @Text(futuredates)) );
weekdays := @Replace( @Text(@Weekday(@TextToTime(t) )); "1" : "7"; "");
concat := weekdays + t;
dts := @Subset(@Subset( @Trim(@Right(@Replace( concat; t; ""); @Length(concat) -1 )); 10);-1);
dts

Sincerely, I would keep all this calculation on the form so that column doesn't have to do this, inturn enhancing the speed of the view

Your call.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question