?
Solved

A real challenge, so if you love challenge, pls join in

Posted on 2006-05-23
15
Medium Priority
?
239 Views
Last Modified: 2013-12-18
Hi all,

I am looking to write a LS agent which does the following:

Creates test document(response to response docs) for product documents based on interval set on the product form. This agent, should look at the interval and somehow in conjunction with the date that the product document has been created, creates tests for docs for 12 month period(supposedly intervals is every 60 days). Once the product age hits month 13, then a new set of test documents should be created for that product for that year and so on....
This agent should take into consideration excluding weekends of interval days. But for some products(customers) may choose to include weekends in their calculation.

If anyone has a better idea on how to implement this automatic creation of test docs for the year period, pls let me know.
0
Comment
Question by:varvoura
  • 5
  • 5
  • 5
15 Comments
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 750 total points
ID: 16741568
Yes, it must be a challenge, but it's YOUR challenge, not mine. Meaning: you'll have to do the bulk, we'll help.

A better idea: create an empty test document when the previous one is marked Completed. Who needs an agent??
0
 

Author Comment

by:varvoura
ID: 16741630
Great, I've already done lots of it, I'll post and wait for suggestion.

I have done creating the test doc, but my manager wanted this to be done differently, hence my above suggestion.

Pls look out for my posting, this one will be quite interesting.

Thanks
0
 
LVL 18

Accepted Solution

by:
marilyng earned 750 total points
ID: 16744197
If "manager wanted this to be done differently" is dictating how he or she wants it done, then why not get with him or her and ask for a more detailed explanation or outline of the steps they were thinking of when they made those suggestions.

If your manager is a developer, then you should be able to ask for reasons why he/she wants it done a particular way.  If the manager set out the goals without specific steps, then he/she is expecting you to come up with the workflow events.  If you don't know how to do this, then ask your manager for clarification.

If he or she is not a developer, then who convinced him or her to want a particular method used in achieving the solution?
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 46

Expert Comment

by:Sjef Bosman
ID: 16744466
Apparently we feel the same: you are jumping to solutions, most likely for the wrong reasons. It is very important, certainly when developing a Notes application, that you think things through all the way. Your application should run today, tomorrow, but also in one year from today. What's more important: you have to build in the necessary flexibility, so that future ideas will usually fit in easily. The initial costs will be higher, initial progress will be slow, but in the end you will save a lot of money.

Prototyping is nice. Prototyping with Notes is VERY dangerous. You've got to have the guts to throw it all away, and start again if your database is wrong.

Well-meant suggested approach: the usual development lifecycle (which might include a little prototyping).

No offence I hope...
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16747153
Agreed.  this is difficult to explain, but when someone presents a list of rules to me, the first thing I ask is "where do you want to end up?"

Continuing: Is this a report that you want?  If so, can you give me a rough example of how you want the data arranged in this report.   And then I try to construct a sentence: "show me all the documents where this, this and this is true, and arrange them in this way.."

Then I see what data I have that fits the end result, and what data I need to collect.
Once I know what I have and what I need, then I need to figure out how to collect what I need, and do this in the simplest way possible.

:))
0
 

Author Comment

by:varvoura
ID: 16749923
Here's my little story. I have spent all day trying to put the requirement in proper perspective so that it will be easier to code.

I'll put down the requirements here, but I am also going to start coding bit by bit of the entire agent so I get it to do what it needs to do properly.

You guys will never offend me, you all have been so great and helpful and especially in those times when I needed most.

As sjef said, it is definitely my challenge so by no means I am expecting someone to come in and hand over an answer, but some help will definitely be appreciated.

REQUIREMENTS - same db with most of my latest posts.

I have a product db, forms again are three:
1. Customer - Main
2. product - response
3. test - response to response

Now, the list of customer will be imported to db and possibly the list of products for each customer too, but a product can also be entered manaully.

What's required is to create test response for each product for the entire year based on intervals set on the product document. The intervals vary, and they are set manually by the customer when he or she create a product document

The trick is that the agent has to take into account all the different intervals and create test documents accordingly and it has to create test documents for the year based on that interval, then when the end of the year is reached, it has to flip back and start the test scheduling again from 0 so that it create a set of tests for the next year.
Yes, the reason for this so it can be used for reporting, for example, a customer can log in and view the amount of test products that needs to be carried a year, hence budget for those test(cost wise)

Also, in regards to interval, if they are set to 30 days, then 12 test documents should be created, if 120 days, then 3 tests should be created for that year, if 178 days then 2 tests documents and 365 days, then one test document. Then we need a measure to check if the product created date = today -365 days, then maybe the hasresponse property which I am setting to "1" when I run these tests should then be set to"0" to start from scratch.

Better still, if a customer decided to change the interval of of test doc then he or she should be prompt if they want to change the entire set of test for the year for that product, selecting "yes" will have to generate some update on the interval field on the remaining tests for that product, selecting no will leave the rest of them as they are.

Although the customer will be allowed to set intervals manually and change them manually, but we will have some measure or validation behind the interval field to keep the test intervals within a specified test period for that product. for example, product A test interval is set by customer to 30 days, if customer decided to change it to 35 days, then that's fine, hence my earlier prompt, they'll will not be allowed to change it to 40 days(field validation)

Agent should account for those customer who want to consider counting the weekends as part of the scheduling, this could be controlled by some sort of a checkbox field on the product document, if checked, then run the routine which includes the weekends, if unchecked then run the routine which does not include the weekend. Both routine(agent) will be exactly the same except that one will take the weekend calculation into account and another one won't.

I am not sure if I skipped something, but this it for now.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16750406
As a matter of fact, I was referring to the entire process, not only the one to produce the agent. If you found out by surprise, half-way during development, that you needed this agent, it would be clear to me that the analysis process wasn't completed. You should have known beforehand that this agent would be required. No use crying over spilt milk, so let's develop the thing.

Some remarks:

- "create test response for each product for the entire year..."
This is far too vague. What is the agent supposed to do on December 31? The definition of the results of the agent should be concise but complete.

- "if a customer decided to change the interval..."
And a customer will do this. What will happen is the previous setting was 30, and the new setting is 10? And the reverse?

- "they'll will not be allowed to change it to 40 days"
Interesting though this is, it has got nothing to do with the development of the agent. By the way, where are you going to store these "40 days"?? As I said in some earlier question, I think there's something missing in your data model.

Now for the agent. Please write, in pseudo-code, what the agent is supposed to do. Use simple words, with a statement per line, so you can describe somewhat formally what the agent is supposed to do. An example:
   
    if it's your birthday then
        do twice
            sing "Happy Birthday to you"
        done
        sing "Happy Birthday dear Vera"
        sing "Happy Birthday to you"
    end if
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16756796
I would suggest a visio flowchart for each process, and then branch with yes/no - conditions --  similar to what sjef is saying, but visio does this graphically.

0
 

Author Comment

by:varvoura
ID: 16759546
I am going to try this this way first to see if we can get something going. If not, I'll take up the flowchart option.

For each product document that exist in view
       check if doc.hasresponse = “Y”
       Check to see if periodending = today
           
if hasresponse = "Y" and PeriodEnding = today then
   Do processendofyear
  End if
   
if hasresponse = 'Y" and PeriodEndign <> today then Exist Sub

if hasreponse = "N" and PeriodEnding <> today then

    Check document interval field on product document
     testinterval = doc.interval

Select Case testinterval

       Case 30 : processsched1
       Case 60: processsched2
       Case 120: processsched3
       Case 178: processsched4
       Case 365: processsched5
   
Case Else:

Set agentLog = New NotesLog("Error in scheduled task")
Call agentLog.OpenMailLog("username@company.com.au","Scheduled Task")
Call agentlog.LogAction("Error in scheduled task")

End Select

Call setvalues
Call productdoc.save
call view.refresh
end if



Processsched1

Dim ses As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim doc1 As NotesDocument
dim count as integer
Set db = ses.CurrentDatabase
Set doc=session.documentcontext

count = 0

if excludeweekend = "Y"
  get the value of excludeweekend and divide by 12 to see how many test docs need to
 be created if the interval is 30 working days

Do until count =< ..extracted value of time calc /12 to the number of test required if interval is 30 days excluding hol and weekend

Set doc1 = db.CreateDocument
doc1.Form = "test"
doc1.field1 = doc.field1
doc1.field2 = doc.field2
doc1.field3=doc.field3
…..
doc1.fieldn = doc.fieldn
Call doc1.MakeResponse(doc)
Call doc1.Save(True,False)
count = count + 1
loop
call setvalues
End If

if excludeweekend = "N" then   ‘excludeweekend Is a field on the doc, Y/N value
 Do while count =< 12

Set doc1 = db.CreateDocument
doc1.Form = "test"
doc1.field1 = doc.field1
doc1.field2 = doc.field2
doc1.field3=doc.field3
…..
doc1.fieldn = doc.fieldn
Call doc1.MakeResponse(doc)
Call doc1.Save(True,False)
count = count + 1
loop
call setvalues
End If


processsched2

Same as processsched1, processsched4, processsched5,

Function SetValues
doc.hasresponse = "Y"
Call doc.save ( True , True )
End Function

Function calculatebusinessdays
…..I have the function for this
End function

function processendofyear
  move docs from that view to another view so that this view can have
  only docs for the current year.
end function

Just a small note to you Experts,

I am so very appreciative of your help and suggestions and I am very well aware that you have extended experience and knowledge. So forgive me if I get a bit naggy and ask too many questions, I am just trying to get ahead with my new position in which I am bombarded with million things to learn and believe me, I am learning so much from all other sources as well as this forum.  I am not just throwing my load on you, even though it may seem like it. I guarantee you this won't be a problem shortly.
0
 

Author Comment

by:varvoura
ID: 16768352
To Page Editor,

I WOULD LIKE THIS QUESTION TO BE DELETED FROM THE FORUM.

a) I have managed after hard call thinking to work out the logic.
b) I will be working on it myself and if I need any questions in regards to portions of the code, I'll then paste it and see if any of the experts can help.

Thank you in advance.
P.S, they'll be no reason not to delete this because no work was done on it.

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16769820
> P.S, they'll be no reason not to delete this because no work was done on it.
No work done?? It's a great step for mankind!

By the way, the pseudo-code I'd have liked to have is even less detailed than yours. You obviously already thing LotusScript. Wrong. Think just plain logic, English, but absulutely unambiguous. Your pseudo-code rewritten (some of it):

For all products in the view  ' what is "the" view??
    If there is a product-test done Then
        If the test ends today Then ' what the hell does that mean, LOGICALLY??
            Do processendofyear
        Else
            Exit Sub ' don't understand!!
        End If
    Else
        If period doesn't end today Then ' don't understand!!
        Check document interval field on product document ' too detailed.
        Process according to interval
...

You lose the overview, you get swamped because of the details. It's like building a house: don't start making a fuss about the wallpaper when the architect has still to draw the first sketches.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16773093
Sometimes just thinking out loud or putting it down so others have to read it clarifies the process.  sjef, don't you think?  If it makes sense to Varvouva then that's all that matters.  :)  But, as sjef says, if you need to request assistance, then what you write has to be in terms that we understand - a common language, if you will.  Else, the only way that we can get a handle on it is to try and reproduce what you have, a painful process when we are speaking two different languages.
0
 

Author Comment

by:varvoura
ID: 16773280
P.S, they'll be no reason not to delete this because no work was done on it.
No work done?? It's a great step for mankind!
Sjef, don't take all my comments literally, except for those technical ones. I so don't mean any harm by this, I am actually a real nice, much too honest person.
What I meant by this is when I requested to delete a question a while ago, I wasn't able because there was a lot of effort put into it. So I thought, we haven't started working on this one and I feel that the question didn't make a lot of sense to me so it won't make too sense to you too, so let's delete and start from something better that we can understand. As Marylin puts it, I am trying to follow your guidelines and speak the same language so I get proper assistance.

Now, let's delete and I'll create a new question for the exact same problem, much clearer and precise so I can get something working within the next couple of days.

Is this fair or what do you both think?


0
 
LVL 18

Expert Comment

by:marilyng
ID: 16773356
I have no problem with this.  But you need to post a note in Customer Service.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16774639
Of course I don't object that the question be deleted :)

PS. What you achieved alone (with a little push from us) is so much better than what we could have written developed for you, even if the coding just isn't all that: it's yours!

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

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
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

864 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