getting cidr from the ipaddress / subnet

I have been working on the hiera data generation / validation process. for generation of certain detail i needed both the ip address in the usual way and cidr way. I had initially asked for both as input, when the user’s came back saying what if i give the subnet information along with the ip address like and you can calculate the CIDR information. Sounds right.

I had initially asked for that from the user because i did not know how to calculate thing. But since the user has asked it to be that way, i started to look into how to arrive that value. I had the first clue with me, the user had told to look in to XOR based calculation. I started with a generic search to first understand what it and how to arrive it.

May be my Search fu is not very good or whatever, my search always lead to getting ip ranges / calculating the subnet mask with CIDR, and not how to arrive at the CIDR.

There were a few calculators which gave what i wanted, but did not explain how to arrive at it. but playing around with them and seeing the outputs, i could sense a sort of pattern emerging, then thought i have seen something like this before. Then i remembered that there was a third party package which some other application was using at work. i searched for it and lo and behold python3 has that function built in. not sure if python2 had it or not.

Python3 has this module ipaddress which can be used for ip address related things. so for my use case all i had to do is call the appropriate function and give the ipaddress/subnet information and get the output. I had to set strict argument to False. so that i would take ip address also as part of input instead of proper cidr.

>>> import ipaddress
>>> network = ipaddress.IPv4Network("", strict=False)
>>> str(network)

Office, programming

Testing hiera data

I have been looking around for ways to validate puppet hiera data files.

my requirements were

  • check if the yaml is well formed.
  • check if all required settings are provided in the yamls
  • check if the required settings values are of expected format
  • inform the how a value is being considered when the setting is present in multiple files in hierarchy.

The basic idea that i had arrived at was to use json schema based validation. Basically create schemas for the various files in the Hiera Hierarchy, and validate each file against its own schema.

I already had a toy project which does that, which i made sometime last year. But, thought would research a little bit and do things a little properly.

I was curious to see if this problem hasn’t been faced by others or not. Searching around the internet found that puppet has a command which sort of does this. it’s not exactly a validation of the data, but what would hiera return when the setting is being requested.

puppet lookup command

That still wouldn’t help in our case. we can see what setting would be applied, but if the engineer has filled it in the correct format or not, if this is a boolean or string, those cannot be validated. also we can lookup only one setting at a time. But it helps in seeing how puppet arrives at the value with the helpful “explain” option.

on further searching i found that the exact same idea has been thought off and they also referred to tools which would help to achieve that.

The post describes about puppet-retrospec and kwalify to achieve that. but those didn’t work out much, seems they are for older version of puppet.

for ensuring if the yaml is right or not, thought there should be something like pylint or jslint, and i was right, a simple search pointed me to something called yamllint. Which also had a python interface with which it can be included into the our scripts. a simple example of it would be like

from yamllint import linter
from yamllint.config import YamlLintConfig

conf = YamlLintConfig('extends: default')

filepath = "./test.yaml"
with open(filepath) as yamlfile:
    yaml =
problems =, conf, filepath)
for problem in problems:
    print(f"{problem.line}:{problem.column} \t {problem.level} \t {problem.desc} ({problem.rule})")

which produces

$ python 
1:1      warning         missing document start "---" (document-start)
3:1      error   duplication of key "a" in mapping (key-duplicates)
3:7      error   no new line character at the end of file (new-line-at-end-of-file)

for a sample yaml

a: "b"
b: "c"
a: "d"

let’s see how it goes.


Sorting Coursera Course List by duration

With the lockdown going on, was too bored. Work from Home, playing with kids and playing Injustice, have sort of become a routine. The first weeks on lockdown I spent the spare time watching Arrow on Airtel Xstream. which suddenly disappeared from the platform. didn’t know what else to do, Coursera announced a free courses saw the cloud computing 101 and thought would refresh my memory on the subject. It was 3 weeks long. With byte sized videos and mostly theory i sort of finished it in 1.5 – 2 weeks. So, thought would look into some other short duration courses.

Coursera page has a categories list and once you select a category from the filters you can select duration and get a list of courses within the selected duration. But then you cannot sort by duration.

I first looked to see if Coursera offered any APIs. They do provide but you have to join their affiliate program. I just want to sort by duration. So this will not be helpful for us.

So I decided to see what happens behind the scenes when I set a filter and then use that to get the data and sort it separately.

So what happens behind the scenes

When checking with dev tools, i observed the following. When we select a filter and click on Apply Filters, a POST request is sent to this URL

that doesn’t seem right, right? the filter information is not there. That information is being sent as post data. Checking the payload, there was this huge JSON data which was being sent. It had all the information, a huge query which coursera backend uses to fetch the required data i guess. but the thing which we are interested in is the variables object

    "productDurationEnum:1-4 Weeks",

the information that we would have to manipulate are limit, start and the value “categoryMultiTag:information-technology” inside the facets list. the limit and start are used to control pagination, and the number of courses to return in a single request. and categoryMultiTag is the course category that we are interested in. Making a request to this URL we get a JSON response, which has the courses information and the pagination.

The pagination details are found under [“data”][“CatalogResultsV2Resource”][“browseV2”][“paging”] which has total number of courses and the next request start value.

The courses list is under [“data”][“CatalogResultsV2Resource”][“browseV2”][“elements”][0][“courses”][“elements”].

Now that we have the required information of where to get the information, what to send and what to expect in response, I wrote a script to recursively get all courses of a category and duration and dump it to csv.

you can find the entire script here

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, 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.


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,


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.

Office, programming

A Ning Network + RSS Feeds + PHP cUrl + MySql + GAE -> WTF?!

We use Ning in our company for the developer community activities around our product.  We wanted to know if there are any topics on forums are unanswered, or what are the topics that were being discussed in the last week, or were any blogs written, and things like that.  To make it simple and easy to understand, something like what happened in the past week / month.

Googled to see if anything as such is available,  as my luck would have, i didn’t find any.  So, i decided to write my own.  Went to Ning API documentation to see if there are any ways to get the data, again a dead end.  It is not available as of now.  But then, i remembered seeing a rss feed of activities in the site, so decided to dig a little more into it.  and land up at this page.  Armed with this piece of info, & since this kind of stuff can’t be done as of now, with our product (if only they provided the data as SOAP service), i sat down to write something to parse the feed, read the data, get the required ones, store it and do the reports.

So sat down to write the feed parser.  decided to use the hosting which i signed up some time back, which i never used, for this purpose. Used PHP cUrl to read the feeds and process it and store it into mysql tables.  everything went well, until they blocked cUrl and socket programming.   I was not in a mood to search for another hosting which supported this.  also, this required me running the php page in a browser so that it can refresh every 15 minutes and get the new data.    So decided to look into something with scheduling and such.

When doing something similar at work, the idea of using Google App Engine for this dawned.  But then App Engine supported only python and Java, which would mean porting from php to any of these languages.  But then, it was Java which gave me a ray of hope.  Since there are many JVM compatible languages around, and if Java was supported, indirectly these languages should also supported.  after a little googling got this information.  And there it was, PHP will work via Quercus.  Digging around their forums, and after looking around, decided to go about doing it.  If it comes up well, then Good, else, it would be one hellava ride, knowing App Engine, Quercus and stuff.

And Challenging it was.  though everything worked without major changes, except storing of data (i was not understanding the examples on how to do it), there was some problems cropping up.  First fetching of atom feeds was not working.  something was a miss.  going around making changes, i couldn’t wat fixed it, after a day it started to work.  But still there was some problem with getting the data, the feed parsing was not returning the feed data for certain tags, turned it did not return the description tag’s data in the rss feed (it was wrapped as CDATA, and was working inconsistently).  Couldn’t figure out why.  and since was pressed for time, decided to fight it another day, and scrapped the required data from another tag’s data.

Next it was Task Queues.  It was not a big difficulty.  actually it was the most easiest, i had a working example.

At this stage, i was at the verge of losing my patience.  It had taken close to 2 weeks, and i was still fighting ( i was on it only on weekends, and you can imagine, how the distractions will be. Cartoons, Movies, Parents, Cooking, Going Out, Cricket, Friends, Twitter, Facebook, Sleeping, Caring for the bike, etc……).  i was pretty much tired of making changes, and just wanted something which will complete the work. Instead of using Data Store for storing the data, and then trying to figure out how to deal with aggregation and joins, decided to go with the mysql in my hosting.  so whipped out a quick script to send data to my hosting from GAE, a php page on my hosting to accept the data via post, validate it and store it into mysql, and another to display the information as  i had wanted it.

At last i have it, something that does what i wanted.  It was a kind of a bit messed up solution, which i had cooked up with all sorts of nonsense ideas ( it seems nonsense when i first thought of ’em ) which i came up.

Now need to, convert it to make use of datastore to store data, which is a trivial task, but then, to do the reports, i think i should change a lot of things, possibly the datamodel structure which i am using now, since datastore does not support joins, it is going to be a challenge for me.  ( i am still the same person, who is not comfortable writing any queries other than select * from table where… and delete from table where….  )

Like i said at the beginning, If it comes up well, then Good, else, it would be one hellava ride.  but frankly, it was both, and boy what a lot of fun it was………  : )

Links where i looked when i was stuck.

The first three are essentially the same…   I would love to share what i had done.  I will, after completing the datastore part of it.

Competition, Hopes, Linux, Office, Open Source, programming, ramblings

Microsoft Silverlight & Linux…….

It has been a long time since i wrote. Well it has been really a long time, stuck in the worst city Bangalore, then moving back. Being in there in certain things. Having a fifteen minutes of fame. Everything was there. I did miss writing here in blogger. Though there was twitter to write to, it is not fun. But a great way to say out ideas short and sweet.

Well, after a long time, and trying to figure a way out to make Linux my main os at work, i succeded last week… Yes! DimensioN Studio 2.4 started to work in linux, it took a little hard work to figure out which files were missing. With a little more help from winetricks, i did get it to work properly via wine. It was so much fun doing it. I was just happy that i need not have to move into windows anymore.

Then i just thought of giving the new browser based cloud product of ours a try from linux. But this darn Microsoft agains comes into frustrate me. Silverlight doesn’t seem to work with linux. and every attempt to make the new product work with Mono Moonlight also failed. It was frustrating to think that i have to login back to windows just to work with something which is browser based. This is not fair…..

Talk about microsoft and fairness, what am i talking? So i had to give the error messages and i was able to only hope that either mono team will release Moonlight 2.0 soon and it would be compatible with Silverlight 3.0, or our engineering team will make sure it will make changes to accomodate the moonlight too. But who knows….

The suddenly today when we were just discussing things, suddenly it turned towards the new product and linux compatibility. And My interviewer asked me why don’t you try with wine or whisky and run the windows version of browser and try to make it work. This was a nice idea. Firefox 3.5.3 was up in 5 minutes, but then again Silverlight decided to play bad. Everything i tried was in vain. Nothing worked. Now i have others in the race. It’s got to be me or the Engineering who should find a way out…. But if others find, that is also fine.

Why?! Why is it that at everyturn a new obstacle arises……

Office, Open Source, programming

Multilevel Menus – ddlevelsmenu

Well, last time i had written that i was supposed to convert a menu from mouseover functionality to onclick. Somehow i had done it, to the satisfaction of whoever i had shown. I don’t know for whom i am doing this, but now i am happy.

The approach was same as everyother attempt at reading code. i have uploaded the js file which i had edited to achieve the desire effect. which you can take it from here. I thought it might be helpful to someone. The original script can be obtained from here (ddlevelsmenu). It works on mouse over, which i had converted to on click. This is a old version of the file that exist over there in their site, just make the same changes over there, to convert it into onclick.

I had commented whatever i had done which might help someone. If there are any unusual or wrong ways, just lemme know, so i can correct it.

The menu still lacks the ability to be on screen, when the mouse moves out of the menu. But it still has made the product a little more usable. That, is what is important. May be another day, another time, after learning Java Script i will make changes to overcome that problem tooo. or may be another version where i can combine both the functionalities with the change of a parameter or something…….

Office, programming

Transfering data from one database to another

Hmm, Most of what i am going to say in this here, will be childish, but still….

DimensioN is built on top of JBOSS. It has some inbuilt functionality to export data from one database to another, with some rules associated with it. and that is great, But what it lacks is you cannot pick and choose which records you want to transfer. That was a problem.

There is a way to atttain the solution for this problem in DimensioN, but the application architecture which we had decided upon did not permit, or to be correct will make it too complex, for the future DimensioN developer to understand and tackle any problems if they should arise. this would invove the logic as follows,

rModify –> DbImport –> rModify….

And as you can see rModify is a bit of a highlevel feature, and many still dread to use it. so the only thing which i could think off was using some thing else which is out of DimensioN but still could be used with it, like Ant target or something.

My first choice was to use Ant target, coz i have done database manipulation with it for an other project, previously. As i can use it as a template and proceed off, and that would save time too. But, i ran into trouble with it, First i had to make javascript to work from inside Ant and then after i had succeded, when i had tried to do the database manipulation, it was creating a exception saying Illegal Access Exception, some AntClassLoader came in and some bullshit which i was not able to understand. and i had waited for 3 days for OS support, but when i came to know that help might not arrive on time, i wanted to put in something to get things going till the support arrived.

Another two days and that jsp expert had not finished the job yet, and they were pressing me for an answer, as though i was a part of that project. ( i had moved to another one even b4 the problem started). Well then, i had to sit back and write the code again for the jsp. (i hate to code. but this was as usual Reverse Engineering, as i would put it,coz i know the basics to do anything, i just did not have the time to proceed to write things from scratch.) I had set a deadline of 4 hours for me to finish. and i sat down to write the code. it took me 3 hours and a half to do it. and it was pretty much good, without any problems, and is working fine.

I know there are still 2 potential pit falls….. (1) I haven’t used a try catch block, so if any exceptions are thrown the page will be a error. which i will have to correct in the future… (2) I haven’t used parameterized prepare statement, so if the data is going to have any problems like a single quote, or anything that would hamper a insert statement on syntax, yet again the page will break with an error.

So with these details, i give you the code. it might be helpful to someone.

<%@ page import=”java.sql.*” %>
<%@ page language=”java” session=”true” %>
<%@ page import=”java.util.*”%>
<%@ page import=”*”%>
<%@ page import=”javax.sql.*”%>
<%@ page import=”org.apache.commons.fileupload.*”%>
<%@ page import=”org.apache.commons.fileupload.disk.*”%>
<%@ page import=”org.apache.commons.fileupload.servlet.*”%>
<%@ page import=”org.springframework.jdbc.core .*”%>
// ExporttoErp.jsp //
// //
// File Created on September 5th 2008 at 1807 hrs. //
// Last Modified on September 5th 2008 at 2030 hrs. //
// Modified By Anbarasan //
// //
// This page exports data from dimension database to navision database. //
// We get the record identifier from the url. //
// Then we proceed to retrive data from dimension and then push it into navision. //
DbExport utility to export Single Record of choice to ERP.
String id=request.getParameter(“docid”);
// Enable the following line to see the primary key id that is being passed. //
// out.println(id);
// Connection to Dimension’s Database //
DataSource dimds = (DataSource)“java:dimension”);
Connection dimconn = null;
dimconn = dimds.getConnection();
// Connection to Navision’s Database //
DataSource navds = (DataSource)“java:erp”);
Connection navconn = null;
navconn = navds.getConnection();

String dimparentqry=”select [Amount],[Bill-to Customer No_],[Chain Name],[Created On Date],[Customer_PO_date],[External Document No_],[Location Code],[Octroi Amount],[Octroi Applicable],[Order Type],[Order Value],[Project Date],[project No_ updation],[Promised Delivery Date],[Req_ delivery Date],[Sales Cordinator Code],[Sales Cordinator Name],[Salesperson Code],[Sell-to Customer No_],[Shortcut Dimension 1 Code],[Shortcut Dimension 12 Code],[DocID] from [xxxxxxxx Pvt_ Ltd_$temp sales header] where docid = ‘”+id+”‘”;
String dimchildqry=”select [Approx_ Cost],[Line No_],[No_],[puchase order no_line],[Quantity],[SODetailsId],[Unit of Measure],[Unit Price],[Variant Code] from [xxxxxxxxx Pvt_ Ltd_$temp sales line] where SODetailsId='”+id+”‘”;

// Enable the following line to see what the data retrival query from dimension database is….. //
// out.println(“<b>ParentQuery</b><br>”+dimparentqry);
// out.println(“<br><br><br>”);
// out.println(“<b>ChildQuery</b><br>”+dimchildqry);
// out.println(“<br><br><br>”);
Statement dimst=dimconn.createStatement();
ResultSet dimrs=dimst.executeQuery(dimparentqry);

String navparentqry=”insert into [xxxxxxxx Pvt_ Ltd_$temp sales header] ([Amount],[Bill-to Customer No_],[Chain Name],[Created On Date],[Customer_PO_date],[External Document No_],[Location Code],[Octroi Amount],[Octroi Applicable],[Order Type],[Order Value],[Project Date],[Project No_],[Promised Delivery Date],[Req_ delivery Date],[Sales Cordinator Code],[Sales Cordinator Name],[Salesperson Code],[Sell-to Customer No_],[Shortcut Dimension 1 Code],[Shortcut Dimension 12 Code],[SO Document ID],[SO No_ Of SCM]) values (“;
navparentqry = navparentqry + dimrs.getString(“Amount”) + “, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Bill-to Customer No_”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Chain Name”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Created On Date”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Customer_PO_date”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“External Document No_”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Location Code”) + “‘, “;
navparentqry = navparentqry + dimrs.getString(“Octroi Amount”) + “, “;
navparentqry = navparentqry + dimrs.getString(“Octroi Applicable”) + “, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Order Type”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Order Value”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Project Date”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“project No_ updation”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Promised Delivery Date”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Req_ delivery Date”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Sales Cordinator Code”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Sales Cordinator Name”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Salesperson Code”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Sell-to Customer No_”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Shortcut Dimension 1 Code”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“Shortcut Dimension 12 Code”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“DocID”) + “‘, “;
navparentqry = navparentqry + “‘” + dimrs.getString(“DocID”) + “‘)”;

// Enable the following line to see what the data posting query to erpdatabase is….. //
// out.println(navparentqry);

PreparedStatement navst=navconn.prepareStatement(navparentqry);

// i don’t know what is wrong with this method, but it throws The statement did not return a result set. //
// ResultSet navrs=navst.executeQuery(navparentqry); //
// navst.executeQuery(navparentqry); //


String navchildqry =”insert into [xxxxxxxx Pvt_ Ltd_$temp sales line] ([Approx_ Cost],[Line No_],[No_],[po no update],[Quantity],[SO No_ Of SCM],[Unit of Measure],[Unit Price],[Variant Code]) values (“;
navchildqry = navchildqry + dimrs.getString(“Approx_ Cost”) +”, “;
navchildqry = navchildqry + dimrs.getString(“Line No_”) +”, “;
navchildqry = navchildqry + “‘” + dimrs.getString(“No_”) +”‘, “;
navchildqry = navchildqry + “‘” + dimrs.getString(“puchase order no_line”) +”‘, “;
navchildqry = navchildqry + dimrs.getString(“Quantity”) +”, “;
navchildqry = navchildqry + “‘” + dimrs.getString(“SODetailsId”) +”‘, “;
navchildqry = navchildqry + “‘” + dimrs.getString(“Unit of Measure”) +”‘, “;
navchildqry = navchildqry + dimrs.getString(“Unit Price”) +”, “;
navchildqry = navchildqry + “‘” + dimrs.getString(“Variant Code”) +”‘) “;

// Enable the following line to see what the data posting query to erp database is….. //
// out.println(navchildqry);

PreparedStatement navst=navconn.prepareStatement(navchildqry);


// A display message to indicate the end of the posting of data process….. //
out.println(“<center><h1>Data Transferred to erp with SO Number : “+id+”</h1></center>”);