Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
38%
Installation Wizard into new VRC
41%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 37

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 10th June 2013, 13:29
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Post Currency Converter Utility!

Hello,

I have created a small utility which can give you the current Dollar Rate for Rupees. By, studying the obtained source of html, you can get the conversion in you own currency. The new release, will be launched soo to converted every currency.

It works on ERP LN fp7.

Try it and put your comments.
Attached Files
File Type: bc Get_Dollar_Rate.bc (2.7 KB, 219 views)
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!

Last edited by bhushanchanda : 13th June 2013 at 20:33.
Reply With Quote
  #2  
Old 11th June 2013, 19:48
~Vamsi's Avatar
~Vamsi ~Vamsi is offline
Guru
 
Join Date: Aug 2001
Location: San Diego CA, USA
Posts: 590
~Vamsi will become famous soon enough
Baan: ~*~ - DB: ~*~ - OS: ~*~
Bhushan,

This is a good first cut at getting the currency rates.

Suggestions for next release:
- Avoid web scraping (http://en.wikipedia.org/wiki/Web_scraping)
- Use a web service instead
- Make it so that the conversion is not hard coded to just one pair of currencies
__________________
~Vamsi
Vamsi Potluru
Baan XL Yet another tool to format Baan output in Excel from Baan Board
This one just happens to be free :)

Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 11th June 2013, 20:11
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Thanks for suggestions :)

Hi Vamsi,

Thank you. I will take care of that the next time. Actually, I searched for the curl commands on the board and didnt found anything relevant, so I decided to add something which will use the curl commands. About using/creating a web service, I have no experience with that. If you have related threads do post them.
I will go for all the conversions in the next release.

Thanks for the suggestions. :)
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #4  
Old 12th June 2013, 18:51
~Vamsi's Avatar
~Vamsi ~Vamsi is offline
Guru
 
Join Date: Aug 2001
Location: San Diego CA, USA
Posts: 590
~Vamsi will become famous soon enough
Baan: ~*~ - DB: ~*~ - OS: ~*~
What follows may be limited to LN with TIV level 1700 and greater. Not tested at lower levels

Bhushan,

You can start with the sample program in the Programmers Guide. See the topic "SOAP client overview" (also referenced at the bottom of this post). The "Example (using ES8.3-8.6 without XML namespaces support)" should work pretty seamlessly. In my instance I only had to add one additional line to make it work.
Code:
	status = curl.setopt.proxy("http://proxy.example.com:80")  | added line to work with my proxy
	| Add the above line anywhere before soap.invoke is called as below
	status = soap.invoke( msgNode,
	   "http://www.webservicex.net/uszip.asmx", responseNode )

The above example uses data from http://www.webservicex.net/uszip.asmx?op=GetInfoByZIP

Now the next step would be to modify the example code to use the currency converter from the same site, which can be seen here:
http://www.webservicex.net/CurrencyC...ConversionRate


Example (using ES8.3-8.6 without XML namespaces support)
Code:
#include <bic_soap>

function main()
{
	long msgNode
	long requestNode
	long responseNode
	long methodNode
	long status
	string zip( 64 )
	string result( 128 )

	zip = "10001"

	| Create a new SOAP message
	msgNode = soap.newMessage( URI_SOAP11 )

	| Define the method to call
	requestNode = xmlNewnode( "GetInfoByZIP" )
	| Set the default namespace
	xmlSetAttribute(requestNode, "xmlns", "http://www.webserviceX.NET" )
	xmlNewDataElement( "USZip", zip, requestNode )

	| Add the method to the SOAP envelope contained the in the SOAP message
	soap.addMethod( msgNode, requestNode )

	| Set the SOAP Action
	soap.setAction( msgNode, "http://www.webserviceX.NET/GetInfoByZIP" )

	| Invoke the SOAP request
	status = soap.invoke( msgNode,
	   "http://www.webservicex.net/uszip.asmx", responseNode )

	| Check the response
	if status = 0 then
		| Get the method result
		methodNode = soap.getMethod( responseNode )
		result = xmlDataElement$( methodNode, "GetInfoByZIPResult" )
	else
		| Something went wrong...
		message( "SOAP Error: %d", status )
	endif

	| Cleanup
	soap.deleteMessage( msgNode )
	soap.deleteMessage( responseNode )
}

Good luck. Hopefully this post serves as an entry point to many Baan programmers who usually do not venture into the world of webservices.
__________________
~Vamsi
Vamsi Potluru
Baan XL Yet another tool to format Baan output in Excel from Baan Board
This one just happens to be free :)

Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #5  
Old 13th June 2013, 08:34
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
New Release!! - Using Web Service!

Hi,

With Vamsi Potluru's help, here's the
New Release of the Currency Converter Using Webservices.
It uses the Web service for its functioning. You can either use it as a 3GL or you can create a session to and allow users to input From Currency & To Currency and then pass the value to your code.

Try it and put your suggestions and comments :)
Attached Files
File Type: bc Get_Dollar_Rate.bc (2.8 KB, 135 views)
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!

Last edited by bhushanchanda : 13th June 2013 at 14:30.
Reply With Quote
  #6  
Old 13th June 2013, 12:57
vamsi_gujjula's Avatar
vamsi_gujjula vamsi_gujjula is offline
Senior Member
 
Join Date: Nov 2011
Location: hyderabad ; india
Posts: 240
vamsi_gujjula is on a distinguished road
Baan: ERPLN fp3 and 10.4 - DB: oracle - OS: Aix , Redhat linux 6
Thumbs up Awesome

---------------------------
__________________
Regards,
Vamsi
Reply With Quote
  #7  
Old 13th June 2013, 14:22
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Smile

Thank you !!
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #8  
Old 16th January 2014, 14:16
jojovalenton jojovalenton is offline
Senior Member
 
Join Date: Aug 2007
Posts: 185
jojovalenton is on a distinguished road
Baan: InforLN FP7 - DB: SQL Server 2008 R2 - OS: Window Server 2008 R2
Hi,

I tried this code and debug and the status appearing to be 7, i'm not sure what's wrong.

Regards,

Jojo
Reply With Quote
  #9  
Old 16th January 2014, 16:38
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

Are you sure? I just tried and it works just fine. Make sure you don't have any typos. Are you using it as a 3GL program or using it in a form with 4GL?

Check the domain for from.c and from.t fields.

Try making changes here like this:-

Code:
xmlNewDataElementNs( ns, "FromCurrency", trim$(from.c), requestNode )
xmlNewDataElementNs( ns, "ToCurrency", trim$(from.t), requestNode )

In the debugger, check if you get proper structure for msgNode & responseNode.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
Sponsored Links
  #10  
Old 17th January 2014, 05:56
jojovalenton jojovalenton is offline
Senior Member
 
Join Date: Aug 2007
Posts: 185
jojovalenton is on a distinguished road
Baan: InforLN FP7 - DB: SQL Server 2008 R2 - OS: Window Server 2008 R2
Hello,

I just copied as it is from your file and paste on the session form scripts and run with debug. Did I missed something?

Regards,

Jojo
Reply With Quote
  #11  
Old 17th January 2014, 07:30
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

Yes, I guess you have not replaced the from.c and from.t variables with the currency codes.

Try replacing from.c with e.g USD
and from.t with e.g. INR and try again.

You can use any currency codes across the world.

e.g.

Code:
xmlNewDataElementNs( ns, "FromCurrency", "USD", requestNode )
xmlNewDataElementNs( ns, "ToCurrency", "INR", requestNode )
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #12  
Old 19th January 2014, 07:15
jojovalenton jojovalenton is offline
Senior Member
 
Join Date: Aug 2007
Posts: 185
jojovalenton is on a distinguished road
Baan: InforLN FP7 - DB: SQL Server 2008 R2 - OS: Window Server 2008 R2
Hello,

I replaced the currencies with parameterized field ccur.f and ccur.t and debug but resulted the same. I attached the same debug result here.

Thanks and Regards,

Jojo
Attached Images
File Type: png xml tree is invalid and status equal to 7 - debug.PNG (63.1 KB, 36 views)
Reply With Quote
  #13  
Old 19th January 2014, 10:50
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

I can see the changes in your code and mine.

Code:
ns = xmlNewNamespace( requestNode, "", "http://www.webserviceX.NET/" )

Your's looks like this:--

Code:
ns = xmlNewNamespace( requestNode, "", "http://www.webservicex.net/" )

Also, check the other lines too.

Make sure, you type the names correctly taking care of upper and lower cases.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #14  
Old 19th January 2014, 15:03
jojovalenton jojovalenton is offline
Senior Member
 
Join Date: Aug 2007
Posts: 185
jojovalenton is on a distinguished road
Baan: InforLN FP7 - DB: SQL Server 2008 R2 - OS: Window Server 2008 R2
Hello,

I made the changes on X.NET but the status still 7. Any LN or tools versions needed to be used for this? Mine is LN FP7 and TIV 1725. SOAP version I am not aware.

Thanks and Regards,

Jojo
Reply With Quote
  #15  
Old 24th January 2014, 06:25
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,314
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

Hmm. That might be the reason. I have a higher TIV.

You can check KB #1181880 for the requirements for SOAP Client.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FX Rate & the Sales Price & Financial Reporting ser_solace Finance, Invoicing and Integration 0 7th April 2011 06:00
Use of rate factor in multi-currency tapzho Blogs and Web links 0 29th July 2008 08:30
exchange currency rate for cost price brad997 Manufacturing & Supply Chain 3 25th August 2006 04:40


All times are GMT +2. The time now is 16:51.


©2001-2017 - Baanboard.com - Baanforums.com