SalesQuoteObject.ReadRecord use

Discussions relating to breakout scripting, .NET and COM programming with Jiwa objects.

SalesQuoteObject.ReadRecord use

Postby dallen » Fri Sep 10, 2010 6:51 pm

Hi,

I have used http://jiwa.net/forums/viewtopic.php?f=14&t=119 as a base, however I did this in c#. Unfortunately I cannot get readrecord to work correctly. Because c# (I'm on 3.5) does not support optional parameters I cannot seem to use readrecord only providing the first three arguments. I normally use reflection's Missing.Value but in this case it does not work.

Beyond an explanation for why this is... What does "filterstring" represent? What is a legit filterstring that I could pass? I pass false for drilldown..

I receive the error:
Error On Fetch : clsRecordSet.FetchRow - No Data Found

If I could get some help with this it would be great. I have tried multiple "solutions":
Empty string as per below
null
Missing.Type
Reflection's MethodInfo (although I could not invoke as I was receiving null back when searching for readrecord..)

Thanks very much.

Code: Select all
string connstr = @"blahblah";
           
            JiwaODBC.database db = new JiwaODBC.database();
            JiwaCommonLib.stdFunctions commlib = new JiwaCommonLib.stdFunctions();
            JiwaLib.StdFunctions jiwalib = new JiwaLib.StdFunctions();
            JiwaSysProfile.clsSysProfile profile = new JiwaSysProfile.clsSysProfile();
           
            db.ConnectionDetails = connstr;
            db.IniFile = @"blahblah";
            profile.Load(db.IniFile);

            DateTime date = new DateTime();
            bool changepass = false;
            if (db.MakeConnections(0))
            {
                db.DoLogOn("blahblah", "blahblah", ref changepass, ref date);
            }
            clsSalesQuote sq = new clsSalesQuote();
            sq.Database = db;
            sq.JiwaCommLib = commlib;
            sq.JLib = jiwalib;
            sq.SystemProfile = profile;

            sq.Setup();
            sq.ReadDefaultBranch();

            sq.ReadRecord(0, 0, "A1C97E5491784DE89F0E", "", false);
dallen
I'm new here
I'm new here
 
Posts: 4
Joined: Thu Sep 09, 2010 10:40 am

Re: SalesQuoteObject.ReadRecord use

Postby dallen » Wed Sep 15, 2010 6:11 pm

Hi,

I ended up using string.empty and false for my values, however I still have no record found.

I note that the original thread also had this problem, so i don't think this is a language problem but something related to the code.

Can someone please have a look at either my code or the original vbscript and advise if something is wrong/missing? That would be great.
dallen
I'm new here
I'm new here
 
Posts: 4
Joined: Thu Sep 09, 2010 10:40 am

Re: SalesQuoteObject.ReadRecord use

Postby Mike.Sheen » Mon Sep 20, 2010 6:55 pm

dallen wrote:Hi,

I ended up using string.empty and false for my values, however I still have no record found.

I note that the original thread also had this problem, so i don't think this is a language problem but something related to the code.

Can someone please have a look at either my code or the original vbscript and advise if something is wrong/missing? That would be great.


The System Profile object you create and pass to the quote object hasn't been told to load an profile.xml, so it doesn't know which logical warehouse it's context is in. All documents like quotes are partitioned into a logical warehouse, so when doing any sort of read it needs to know the logical warehouse.

You can verify this by checking the return value the ReadRecord returned : if 0 then an error occurred, and check the ErrorString property to reveal the cause - if it is "No data found" then my assertion above is correct.

If this is the case, try the following code after you instantiate the system profile object :
Code: Select all
SystemProfile.Load("C:\Program Files\Jiwa Financials\Jiwa\jiwa.xml")
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SalesQuoteObject.ReadRecord use

Postby dallen » Tue Sep 21, 2010 4:18 pm

Hi Mike,

Thanks for the response. I had a look at my code and I believe I am doing this - the line which is profile.load(db.inifile) directly after setting the inifile. Is there anything else I am missing?
dallen
I'm new here
I'm new here
 
Posts: 4
Joined: Thu Sep 09, 2010 10:40 am

Re: SalesQuoteObject.ReadRecord use

Postby Mike.Sheen » Fri Sep 24, 2010 7:36 pm

dallen wrote:Hi Mike,

Thanks for the response. I had a look at my code and I believe I am doing this - the line which is profile.load(db.inifile) directly after setting the inifile. Is there anything else I am missing?


Not sure - certainly you should be examining the return code DoLogon returns, if it is 0, then you should examine the error properties (errorstring / message and error module).
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SalesQuoteObject.ReadRecord use

Postby dallen » Mon Sep 27, 2010 11:52 am

Hi Mike,

It turned out to be the logical warehouse not being set - after adding that it worked fine.

For future people looking at this post:
Code: Select all
if (db.MakeConnections(0))
            {
                db.DoLogOn("user", "password", ref changepass, ref date);
            }

becomes
Code: Select all
if (db.MakeConnections(0))
            {
                db.DoLogOn("user", "password", ref changepass, ref date);
            }
db.CurrentLogicalWarehouseID = "logicalid";
dallen
I'm new here
I'm new here
 
Posts: 4
Joined: Thu Sep 09, 2010 10:40 am

Re: SalesQuoteObject.ReadRecord use

Postby Mike.Sheen » Mon Sep 27, 2010 10:40 pm

dallen wrote:Hi Mike,

It turned out to be the logical warehouse not being set - after adding that it worked fine.

For future people looking at this post:
Code: Select all
if (db.MakeConnections(0))
            {
                db.DoLogOn("user", "password", ref changepass, ref date);
            }

becomes
Code: Select all
if (db.MakeConnections(0))
            {
                db.DoLogOn("user", "password", ref changepass, ref date);
            }
db.CurrentLogicalWarehouseID = "logicalid";


Excellent - thanks for posting back your solution!
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical / Programming

Who is online

Users browsing this forum: No registered users and 12 guests