Solved

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

Posted on 2004-03-30
9
212 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A short film showing how OnPage and Connectwise integration works.

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now