Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Does Powerbuilder has CHIDIST (in excel) function?

Posted on 2004-03-24
11
Medium Priority
?
687 Views
Last Modified: 2013-12-26
Hi,
   I would like to use the excel function named CHIDIST (chi-square distribution statistical function) in Powerbuilder. Unfortunately I can't find powerbuilder have this kind of build-in function. Does any one know how to write our own CHIDIST function in Power Builder? Thanks in advance. I appreaciate your advice very much. Thanks again.
0
Comment
Question by:cindylsn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 8

Expert Comment

by:Vikas_Dixit
ID: 10667065
I don't think PB has a similar function...
I you are already using excell in your app, may be you can call this excell function in PB through OLE...

--VIkas
0
 

Author Comment

by:cindylsn
ID: 10673205
I don't use excel in my application... :O( wish that I can write a CHIDIST function in Powerbuilder.
0
 
LVL 18

Expert Comment

by:diasroshan
ID: 10674407
hi,
it might be difficult to write a CHIDIST function in powerbuilder...but what u can do is ..if u know visual basic (CHIDIST function is readily available) u can write a code in visual basic ,make a .dll and call it in powerbuilder....
let me know if u need more help...

Cheers,
Rosh
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:cindylsn
ID: 10683374
hi Rosh,
 Thanks for the idea. Unfortunately I know nothing abt VB. Can someone help me in writting the .dll file with CHIDIST function so that I can use that in my PB application. appreciate ur help very much. thanks
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10683694
Here is the piece of code that will do the trick.

oleobject lole_object
long ll_result
string ls_value

lole_object = create oleobject
ll_result = lole_object.ConnectToNewObject( "excel.application")
lole_object.application.visible = false

ls_Value = String(lole_object.Application.WorksheetFunction.CHIDIST(10, 20))
MessageBox("debug", ls_value)

If IsValid(lole_object) then destroy lole_object

Regards

Namasi Navaretnam
0
 

Author Comment

by:cindylsn
ID: 10683817
hi Namasi,
 Thanks for the sample code. This is what I did right now. But I prefer using a dll rather than create the OLE object connect and destroy it for each record. the query returns me more than 100,000 of records and each record need to calculate for CHIDIST. this is time comsuming.
0
 
LVL 18

Expert Comment

by:diasroshan
ID: 10684232
hi cindylsn,
well if u can lend me some time i can attempt to write a dll in vb and possibly mail the code to u...

Cheers,
Rosh
0
 

Author Comment

by:cindylsn
ID: 10684319
well ok.. hope to see ur reply soon. thanks
0
 
LVL 18

Accepted Solution

by:
diasroshan earned 375 total points
ID: 10684457
hi  cindylsn,

the code put in my namasi will serve ur purpose ....
...the time consuming problem u have written abt does not arise..
i tried it with a dw of mine which returns 5000 rows and it was cool breeze...
...with the only exception that all my 5000 records return at one go....
..so i did the following.....

oleobject lole_object
long ll_result, i, ll_val1, ll_val2
string ls_value, ls_val[]
Decimal{2} ld_result
 
lole_object = create oleobject
ll_result = lole_object.ConnectToNewObject( "excel.application")
lole_object.application.visible = false

//dw_1 returns 5000+ rows
For i = 1 to dw_1.RowCount()
      ll_val1 = dw_1.Object.val1[i]
      ll_val2 = dw_1.Object.val2[i]
      ls_Value = String(lole_object.Application.WorksheetFunction.CHIDIST(ll_val1, ll_val2))
      ls_val[i] = ls_value   // take it into an array
      //or,
       ld_result = Dec(ls_value)
       dw_1.Object.result[i] = ld_result
Next
If IsValid(lole_object) then destroy lole_object

but if ur datawindow returns one row at a time then u have a problem with time....

if the above suggestion helps well and good if u still have a problem let me know exaclty what u want the dll to return....

Cheers...
Rosh





0
 
LVL 8

Expert Comment

by:Vikas_Dixit
ID: 10688761
Hi,

This is as I have suggested... You will need MS Excell to be installed with your app for this code to work...

Regards,
VIkas
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10689518
Yes. Execution time should not be issue as you will need to connect to excel only once.

Regards-
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

688 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