Solved

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

Posted on 2004-03-30
9
210 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

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.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

16 Experts available now in Live!

Get 1:1 Help Now