Office, programming, What the...

Birthday Alerts app [version 2]

When i wrote last time how i made the birthday alerts app , i wrote, how, because of a property of SLA, the data had to be entered at that time of the day when you want to receive on the desired day.  (I know i am being confusing because i am trying to say it all in one line, read the previous post and you will understand).  Well now you don’t have to,  and have made the logic behind the app mucho simpler.  Well, the process flow part is just one activity, apart from start and end, unlike the previous time, when it was like, 7 or 8 activities.  It is still 7 fields, and all logics have been moved to actions.

The activity Reminders has  a SLA set on it.  The time duration is obtained from the field RemindIn.  The two actions in this are, one to calculate the time, when to remind and the other one, to send the reminder and reset it for the next round.  The changed datamodel is as follows.

The calculations done to get the RemindIn time duration is as follows.

  • DayNextYear = (DATE(YEAR(NOW())+1,MONTH(Birthday),DAY(Birthday)))
  • DayThisYear = (DATE(YEAR(NOW()),MONTH(Birthday),DAY(Birthday)))
  • RemindIn = IF(Birthday>NOW(),(Birthday-TODAY()-1)*24+HOUR((TODAY()+1)-NOW()),IF(DayThisYear>NOW(),(DayThisYear-TODAY()-1)*24+HOUR((TODAY()+1)-NOW()),(DayNextYear-TODAY()-1)*24+HOUR((TODAY()+1)-NOW())))
Well that’s it.  Think anything is amiss, or some other thing, that should be there, lemme know.
About this app:
This is a simple app, which takes in the date on which you have to be reminded, and sends you a mail about what you want to be reminded.   It will automatically remind you every year [since, you see, birthday’s / Anniversaries come only yearly].
Office

The Cancel problem!

Anyone who has been using OrangeScape, will know about the auto save feature (in runtime).   (I use the word “auto save”,  just coz,  i could not think of any other word, which will explain what i am trying to say).

Once you type in a field in your application, and move to the next field, the first field value will be automatically saved.   (Didn’t they say they use AJAX too).   But sometimes, this is not required.   So, for those who do not require that data be saved to the backend immediately, OrangeScape has three options which you can set, and control when the data is sent back to the server, to be saved to the backend.  In Form Design, in the Ribbon, under the category Cell,  you can see three options : Dont Submit, Submit, Submit on Dependency.    Lemme briefly say what these three options are.

  • Dont Submit : as the name says, the field data will not be sent to server, as and when the field data changes.  The whole form will be submitted when you submit the form.
  • Submit : The field data will be sent to server on every change.
  • Submit on Dependency : The data will be sent only if there are any formula / rule which depends on the value of the field which is currently being changed.  All data till that point which has been entered will be sent to server.  for ex.  if you have 3 fields, name, qty and amount.  Amount will be calculated based on formula which involves qty, then when you change qty, the name field value will also be sent to server.

The default is Submit on Dependency.

Ok! after all these details, you must be thinking, then what is this Cancel button problem that i am talking about.  If you aren’t, then, after reading the scenario, you will.

Disclaimer:  The following process / scenario / Persons in this scenario is a fictional one.  any resemblance to an existing process / scenario / Persons is purely coincidental.    Few words of technical mumbo-jumbo can be seen.  I apologize.

Warning : This is a really long & boring blog post.

Let’s assume, that you are updating profile details, which you created when you first logged in to this awesome application created with orangescape.  Let’s see what details are there in the  form.  There is the usual, first name, last name, date of birth,  address, country, state, city.  This person, who is editing, has moved to a city in another State.

Let’s make another assumption,  that all fields have been set as Dont Submit.  so what will happen, the user will change the address, the State in the State drop down, then will try to change the City in the City drop down.  But wait!  the city drop down is still showing cities belonging to the previous chosen State.  Why? because, the application does not know, what are the cities in the State which you have chosen.  It has to communicate with the server, and then find out what are the cities in the state you have chosen, and then show it to you.  But it has been set as Dont Submit, which means communications to server have been bared till you submit the page.

Now, this leaves us with no other choice, other than to change the setting to Submit on Dependency on the three drop downs (Country, State, City).    Now after changing the address, the person chooses the state, now, a request will be sent to server the fetch the data for the list of cities belonging to the state chosen.  At this point, in the request sent to the server, the data which has been modified till this point will be submitted.  Which means the address has been saved.

Well, what’s the problem you ask?! The person had a change of mind, and does not want to carry on with the update, and want to cancel and go back to how it was previously.  Unfortunately, it can’t be done.  the data has been changed and saved.  There is no way of getting it back.  Ah!  now you get the problem?!!

So how to do we solve this problem?!!  During a discussion at work, a person with whom i work with, gave this idea, which he had used in another application of his.  Which was good.  And this would also help those who want to track every change that their users did, during every submit.  Yeah!  you are thinking right.

Data versioning

Data Versioning,  essentially what you will be doing is, whenever you open a record to edit, you will be actually opening a copy of the data to edit, and if everything is ok, and you want to submit the changes, then they will be changed, else you can discard the data.  (or you can store it and see how the user changed the data from what to what, etc.,  But be responsible with what you do.)

Whatever you wanna call this :  This is not the only way.  May be there are (will be) other alternatives.  If you are going to use this, welcome aboard.

Ok!  let’s say we have one model, for which we want to implement this.  Let’s see how to do it.

Now, keep only those fields, which are absolute necessary in this model.  Leave out fields for validations, flags for permissions and all those unnecessary stuff.  Create one more model, when you can write all those unnecessary stuff + all your fields which are absolute necessary.  Let’s call the model with absolute necessary fields as Transactions and the other model with all the unnecessary stuff + absolute necessary fields as History.

We need 2 more fields in the Transaction model as connections to History model, and 1 field in History model as connection to Transaction model.    The following logic, will be really confusing, coz, i was getting confused with this logic, when listening, when explaining, and also when doing.  So most probably i will be writing this in the same confused way.  Be prepared to be confused.

In Transactions model i am going to create three actions.

  • Create History
    • A NEW Command which will create a copy of the current data in History model for editing
  • Update Transactions
    • An UPDATE Command, which sets the value of Draft into Current.
  • Workflow
    • An UPDATE Command, which releases the History command from draft state to commit state.
    • A Submit Command, to proceed in the workflow.

Now lets move to History Model.  Here i am going to create just one action

  • Update Entries
    • Two PARENTCALL Commands, first one to call Update Transactions, and 2nd one to call WorkFlow action.
In Transactions in all fields i have written DGET() to fetch data from History model, based on the “Current”  Reference Field.  As for the forms, i had designed the forms in History Model, and used that form as a Many To One form via Draft reference field.  and for the submit, i had used the Update Entries Action.  thats it.  O!  i totally forgot, that CreateHistory action, that will fire everytime a record comes to the activity, i have used the Connect -> Action in the Process Design to set it.
So how it Works?!#@.
Once you create a new record or submit an existing record, the Create History will be called, and a new History record will be created with existing set of values.  For ex:  lets consider a simple model Transaction

So, when a new record is created / a record is submitted , CreateHistory action is called, and a History record is created via the NEW command, and reference to the newly created record is set in the Draft Reference Cell in Transactions model and a reference to Transactions model is set in History reference cell in History model.  Now based on the Draft reference cell, the newly created History model record will show in the form as a Many to one record.  The user will make changes / enter data in this form.    So, all data are being entered into History model record.  Till the user clicks submit button all data will reside in History model.  If the user decides to cancel, then you can either discard the History model record, or store it as editing history.

Ok!  So when the user submits, via the call child action we set the value of the Current Reference cell to the value in Draft Reference Cell.  Now, all DGET() functions in the Transaction model will fire based on the Current Reference Cell value, and sync the data which was entered / changed in the current submitted version of the History Record.  Then we will clear the Draft Reference Cell value to blank, so that the Current Referenced and Draft Referenced records are not the same records.

So That’s it.  I have done it and tested, and it is working.  But don’t take my word for it.  Please try it out, and understand what is really happening.  This may or may not get complex based on your scenarios.    I know,  i know, it is already confusing, and i am writing this whole thing, in the middle of the night, half asleep.

If you still got questions, please post your questions in the comments.  Or, if you think you have an even better idea, lemme know, we can make things work better,.

Office, programming, What the...

Delete records along with Worktop count change

Well, well, well, sometimes, in your application you would have to delete your records because you created one request extra, or instead of raising a request in this you raised a request under another category.

If the application is developed in Orangescape,  if you delete a record, the count in the worktop will not go down, it will continue to show the count which was there before the record was deleted.  So how do you delete the records, and also have proper count in worktop?!!!

Orangescape, it seems is done with the assumption that no transaction record will be deleted, but will be archived.  Yeah, but in some places, it is not a requirement, you are free to delete the records.  So how to do that.  Let’s see how to do it.

Warning :  This involves using System Models, if not done properly, could lead to problems, and i am not to be held responsible

Assumptions :  I hope you know how to delete a record from inbox, because that is the method, am gonna use and am not going into the details.  Also, i hope that you guys understand the relationships which exist with your models and the system models.

Ok.  So, if you still reading, lets do it.  before that, a little explanation,  We will be dealing with one System Model => Process Instance.  But because of the procedure which we are going to do, data in two system models will be affected. They are => Process Instance, Process Audit.  Process Instance and Process Audit, together hold the who did what in the application,  information.    OK, lets get down, and get our hands dirty, shall we?

Open the Process Instance Model, Create a new action, and name it something, lets say, “Eraser”.  In that action, add the delete command.  Save the Model and close it.

Now, open the model where you want the delete functionality.  add a new action or you can also use the existing action which you have configured to delete the record.   The first command that you are going to add in this action is CallParentAction.  in CallParentAction properties,

  • for Parent – Model you will choose ProcessInstance(ProcessInstance).
  • for ParentAction-Name you will choose the action which we created now, in this case “Eraser”

the next command that you will add is the delete command. that’s it.  The action design should look like this.

Now add this action to the inbox…  Now Whenever you execute this action,  the Worktop count  will also be recalculated to reflect the changes…..

Woah!  Howzzzzat?!

Update:  as @Vaithi_G puts it, this is good for models with straight process flow, but if there are branches you will have to include atleast two more CallParentActions for each OR or AND branches, which will make the config tedious for every branching in process, as he had suggested, you can use RCall command once instead of CallParentAction command.  If you use RCall, the Parameter configuration is as follows

  • Choose ProcessInstance in Model-Name list.
  • for CallAction-Name enter the Action Name, again in this case “Eraser”
  • for Search-Criteria enter =Criteria(ProcessInstance.InstanceId=SheetId)

Another Update@VivekMadurai says, that in next version, the first method (using CallParentAction) itself will delete all Process Instances even though there are multiple branches.  so for the sake of performance, don’t use the RCall Command method after 2 weeks.

Office, programming, What the...

Birthday Alerts App

A few months back during a discussion in the office @JohnPrawyn was talking about some difficulty in doing a birthday alerts app using orangescape, (orangescapian’s birthday alerts is his responsibility).  Then I just forgot about it.

2 days back,  i fell asleep while reading, and i had a dream about the implementation of the birthday app,  I woke up and quickly noted down what ever i had remembered.  It was simple, but there were some small problems….  So here is the process flow, which i had dreamed.

BirthDayReminderProcessFlowInOrangeScape

There are no ways to schedule things as of now (maybe some feature is on the pipeline!),   so i decided to use the SLA feature.  Checks are done to find the Birthday every month / week / day (based on the nearness of the alert day).

The above process flow, is flawless on the paper, now have set some data to check it.

So, are you still wondering what was the small problem that i had talked about.  Yeah, there is a problem there.  A feature of SLA is that the time duration to check will start off once the request reaches the particular activity.  which means, for ex.  In the Process Flow above, if the request reaches the activity Initialize, at say evening 4:30 and the SLA hours are set as 24 hours, then the activity will next happen tomorrow at 4:30 in the evening.  Which means, to get the reminder at the beginning of the day, i should sit at the beginning of the day and set the reminder.  Will need to find a work around on that.  (i have one, but let me first finish the testing of this first, it everything works fine, then i will implement it out.)

O!  and there are only 6 fields (+ system fields) in the model,

BirthDayReminderModel

Well anyway, i had dreamed of solutions before, but nothing of this sort has happened.  It would usually be like conversing with someone and coming up with something, but not the complete answer to a question.

Competition, Office

How i stopped worrying and added a chart

Ok.. Now everything is over.  Ok, it was over last week itself.  I even got a iPod shuffle!  I will let you all see what i was talking about that night.

Bogzilla

Nice isn’t it?!  Yeah, I know.  Many were not even wondering about how i got that ui.  (Seems they all know how to do it, it was not a secret afterall!).  They were only asking about the pie chart.  So lemme go about how i stopped worrying and added the chart.

Well actually it was not a big thing.  I used Google Charts for generating the chart image and then hooked it up into my form.  That is it.   Ok, i can understand you are starting to frown.  I will give you the details.    Basically i got all the details that i required for generating the charts using the DCOUNTA() function.  That is what appears in the right column above the chart.

B8=DCOUNTA(Issue.CreatedBy,Issue.CurrentStatus,Issue.CurrentStatus=”New”,TRUE)

D8=DCOUNTA(Issue.CreatedBy,Issue.CurrentStatus,Issue.CurrentStatus=”Open”,TRUE)

F8=DCOUNTA(Issue.CreatedBy,Issue.CurrentStatus,Issue.CurrentStatus=”Resolved”,TRUE)

H8=DCOUNTA(Issue.CreatedBy,Issue.CurrentStatus,Issue.CurrentStatus=”ReOpen”,TRUE)

J8=DCOUNTA(Issue.CreatedBy,Issue.CurrentStatus,Issue.CurrentStatus=”Verified”,TRUE)

Now i had got the url constructed for this chart using the CONCATENATE() function.

=CONCATENATE(“<img src=’http://chart.apis.google.com/chart?chs=200×300&cht=p3&chco=93CE11|DF6800|FFEFCB|FF0000|CCCCCC&chd=t:”, B8,”,”,D8,”,”,F8,”,”,H8,”,”,J8,”&chdl=New|Open|Resolved|ReOpen|Verified&chdlp=b’ width=’200′ height=’300′ alt=” />”)

Ok, i had also added the HTML tags to display the image along with this… Sheeh!  is it that bad to bend a little, afterall how will i ever let the form know that the output of this an image, if am not going to add HTML img tag.

Click here to see the same chart which you are seeing in the screen shot.  You can look at the address bar to see the constructed URL.

You can find the explanation for the url parameters here.  If you find it too daunting to go thru and read all the info there, use the Chart Wizard to construct the url and then change the values with your field names or variables.

Have fun!

Office

Postponed!

The Review of mine and my colleagues has been postponed to wednesday!   Well,  i was kinda worried with what more i can do, and by evening, another idea appeared, which was kinda crazy, one question led to another, siva saying not possible, adhi saying no way, pavitha saying why doing all these nonsense, it is way more easy, in the midst of the chaos, it started to seem that, the crazy idea might be possible.  This can’t be disclosed as of now.  Siva was not sure if it can be done.

After nearly 3 hours with the paper mock ups and nothing leading nowhere, i decided to start with the first part.  after an hour and 22 minutes i saw the line.  The very first line which i saw when i started on this small adventure.  Yup!  it was right there in front of my eyes and i was searching for it for such a long time.

So now, I am sure, i can do this thing that i am planing, and if possible, i will do it by wednesday afternoon, so that i can show it up during the review, instead of the one that i am having now.

Since i have put tooooooo much suspense, i will give you this small clue.  Everything is a Form, I mean Everything…..  ok, that is not entierly true, i will use the other perspective’s also.

Competition, Office

“Create New” Wizard in Tracker

Ha! Atlast, i just completed the screen design and the permissions, for the Wizard to submit a issue, in the application, as i had decided with the mockup. It is not too great, but yeah, that’s a great achievement for me. After having had to handle everyone in the world, i got to complete this., Wheeeeee! ok. i need to cool down. so this is it….

Yes!, The design has been done, and it is working good. No problems yet!, (coming to think of it, i have not yet submitted from the final screen. Wait, ok even that works). It flows good, moves from one screen to another normally, the help messages come up good. yeah everything fine, except the images loading times, coz the images have to come from my storage on the internet instead of from application, it is taking time. But other than that everything is fine.

Now i need to think of other ways to make the other screens in the application, interesting.

Something i noted in the product today, was that the deployment popup was retaining the Applicaiton Id and UserId for authentication most of the time, but yeah few times it was not there.  I don’t know why.  Have they implemented this feature, or is it Firefox playing tricks?!

Competition, Office

“Create New” screen Mock Up

I hope you guys know of the Developer Competition which just recently ended up last week.  I had been developing an app for it.  But after seeing the previews on Friday Evening, i know one thing.  I don’t stand a chance of winning.  So, now i am going to do one thing which is the sensible thing.  The Standards have been raised, so now i have raise to that level.

The one thing which i was developing is an issue / bug tracker.  I have created a mock up for the issue creation screen, which i am going to sit thru and create today.  Thought i would put it up here, so i don’t have to refer for it anywhere else when required.

This is how the screen is going to look.  I am changing it to look like a wizard, making the user to go thru steps to collect the data regarding the issues.  I am still in confusion as to how to use put the step numbers, either as just numbers in a square box, or like the one which is drawn at the top, seperately.  Will put up a screen shot as soon as i am finished with it.,

Linux

Windows as a Guest on a Linux (ubuntu) host

After having been through all those days of triple boot and quadruple boot systems, i am coming back to a single boot machine now.  This time with my work laptop with Ubuntu as the main and the only OS.  Since i knew i could never complete that dream of running everything from linux in my work place in the near future, i decided to go with the only other choice to achieve it with immediate effect.

So what are my work place requirements. i need to have a firefox with silverlight.  That is the only thing for which i need Windows, ok, may be occasionaly for something else like, i don’t know…. I can’t think of any thing else.  and though even that can be circumnavigated with Wine, the video chat on gmail is another thing which will become a road block.

So to solve these, i decided to install Windows on Virtual Box with Ubuntu as Host.  This i thought will solve the problem.  But, yeah it did solve the problem of firefox with silverlight.  But Virtual Box is not allowing to enable to use of webcam to the guest OS.  It has to be a small problem somewhere i think.  Will look into it.  And to solve the problem of not having a anti-virus, I am allowing internet only to firefox, and have removed the access to the rest of the system.  I did it with Squid on the host.  It feels good, to be close to achieving the original thought.  But i can live with a little Evil i guess.

For Virtual Box installation i followed the instructions in this page under the title Debian Based Distributions.  Just in case if you are not able to open it.

add the following line in your repositories list in Synaptic Package Manager (settings -> repositories -> other software)

deb http://download.virtualbox.org/virtualbox/debian lucid non-free

add the key to the Synaptic Package Manager (settings -> repositories -> authentication)

then say

sudo apt-get update
sudo apt-get install virtualbox-3.2

That should do it.  I mean that is all i did. and i had to go thru this to understand how to access shared folders form host to guest and why the display resolution went to 800×600 when i made the shared folder access to work.  It was frustrating, the display always going to 800×600 from 1024×768  finally figured out, that it was the Virtual Box Display Driver which was causing it.  Then i just uninstalled just the display driver, and override it with the default driver whatever windows took itself.  And that is it.  Things are working fine for now.  Just the small thorn of WebCam access from host to guest.  Will soon try to find a way out.


							
Linux, Office

Orangescape Studio

I have been trying for a complete switch to Linux in my laptop for a long time.  Though i achieved it for my desktop in home, Every time i get a plan to switch to linux, the Engg dept comes up with a new version which makes me to wait some more.

But with WINE i had been able to make the things to work in linux.  But as it happens, many a time the application fail to work even with wine.  Now after close to 4 to 5 months of trying to make the new Orangescape studio work on linux, atlast it works.  Even though it is a webapp still we need wine.

The latest Update of Kernel to 2.6.31-20 + a higher internet connection speed made it possible.  I had installed WINE 1.1.31 long back.  I had installed Silverlight 3 + Firefox 3.5.6 (windows version) on WINE.  It had not been working till last weekend, when i last updated the system. (Kernel version 2.6.31-20).  Plus the new changes which the Engg made over the last week.  Now it is working.  I did some basic validations and a straight workflow.  It worked well.  But i could notice the CPU usage shooting up when doing Workflow design.  But nothing so great to make the system unstable or crash to firefox as how it was happening before.

Studio

Studio

Process Designer

Orangescape Studio - Process Designer

The Browser


The Operating System

But it is not working with moonlight.  Seems moonlight has a lot of catching up to do.

The Machine:

  • Intel Core 2 Duo T5800 @ 2 Ghz
  • 2GB RAM
  • Ubuntu 9.10 (karmic koala)

Update:

It works with Firefox 3.6, and seems like with Fx3.6 the working is more smother than with Fx3.5.x.  The CPU doesn’t go above 60% when loading or using Process Designer, which was not the case with the previous versions.  It would hit 95% in both CPU’s of my laptop in Fx3.5.x.  May be i should be using it a bit more regularly and try out different things before going all out on the decision of deleting Windoze out.  Still have a few doubts where it might stumble or even crash.  Need to check those out.