Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-03-30
9
Medium Priority
?
235 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 800 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

604 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