Increment number

L

Lise

Hello,
I have searched this forum for an answer, but all I can find is questions
regarding this issue - not solutions. What I want is an autogenerated
ordernumber that increments with +1 when opened and saved. What is the best
solution to accomplish this?
I am new to VBscript, and C# and all other Microsoft programming language.
Thank you very much!

/Lise
 
T

Tlear

Hi
Lise
I found this to be hard
What i ended up doing was submitting the form to the data base after filling
in the first field.
When submitting it to the database, leave the form open and the number will
fill in.
You can finish the form and submit it to the database to update and not make
a new number.

I hope that helps

Let me know if it doent
 
L

Lise

Hi Alex,

Thank you for your answer. Let me explain the entire scenario:
I have a customer who wants to use InfoPath for their Flight Requests and
they want an ordernumber to be created automatically by InfoPath. We do not
use any data source in this form, but we would like to be able to export it
to Axapta later on (if needed). So when the user creates a request, the
ordernumber is filled in automatically with a structure like "FR-0001". Is
this possible? The best thing would be to have an external file that is
updated, but I do not know how to accomplish that.
Thank you very much!
/Lise
 
L

Lise

Thanks Alex !
Yes I thought that writing a webservice would be the preferred solution. The
problem is that I do not know how to do that... Sorry for being a rookie on
this :)
Could you post a URL or something that describes how to do it?
Many thanks!
/Lise

Alex said:
Lise,

There are three ways to approach your scenario:

1. During save, write this last used ID to a local file. Your solution
needs to be fully trusted or you will get a security warning based on
the zone.

2. Have a custom task pane and use IE's one of the many storage
mechanisms (e.g. userdata, cookie etc)

3. Write a web service and use secondary data source to query it for the
current order number.

I would recommend #3 as the most robust mechanism, especially if the
customer plans to roll out the form to several data entry persons (order
number generation process needs to be synchronized - a web service is
perfect for that).

Let me know if you need more help!

Good luck,
Alex @ Microsoft



-----Original Message-----
From: Lise [mailto:[email protected]]
Posted At: Tuesday, May 10, 2005 11:59 PM
Posted To: microsoft.public.infopath
Conversation: Increment number
Subject: Re: Increment number

Hi Alex,

Thank you for your answer. Let me explain the entire scenario:
I have a customer who wants to use InfoPath for their Flight Requests
and
they want an ordernumber to be created automatically by InfoPath. We do
not
use any data source in this form, but we would like to be able to export
it
to Axapta later on (if needed). So when the user creates a request, the
ordernumber is filled in automatically with a structure like "FR-0001".
Is
this possible? The best thing would be to have an external file that is
updated, but I do not know how to accomplish that.
Thank you very much!
/Lise


Alex said:
Lise,

You can automatically generate order numbers on the database side. For
example, if you want to auto-increment PurchaseOrderID in the Orders
table, create a primary key for PurchaseOrderID that would
autoincrement, and create an InfoPath form template that allows users to
submit order details. In that form, users won't have to specify the
order number - and you don't need to worry about generating one. All
will be done on the database side.

If this doesn't work for you, please tell me more about your scenario;
why do you need to create a purchase order number on the client side?

Good luck,
Alex @ Microsoft

-----Original Message-----
From: Lise [mailto:[email protected]]
Posted At: Tuesday, May 10, 2005 4:02 AM
Posted To: microsoft.public.infopath
Conversation: Increment number
Subject: Increment number

Hello,
I have searched this forum for an answer, but all I can find is
questions
regarding this issue - not solutions. What I want is an autogenerated
ordernumber that increments with +1 when opened and saved. What is the
best
solution to accomplish this?
I am new to VBscript, and C# and all other Microsoft programming
language.
Thank you very much!

/Lise
 
L

Lise

thank you very much Alex!
Best regards
/Lise

Alex said:
Lise, here are some tutorials that should get you started on web
services:

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q301273&ID=KB;EN
-US;Q301273

http://abstractvb.com/code.asp?A=1006

http://www.codeguru.com/Csharp/Csharp/cs_webservices/tutorials/article.p
hp/c5477/

The logic of your web service should be as following:
1) Lock the file for writing (to avoid synchronization problems)
2) Read the value from file
3) Increment the value by 1
4) Write the incremented value back to file
5) Unlock the file
4) Give the incremented value back to the requestor

Good luck,
Alex @ Microsoft


-----Original Message-----
From: Lise [mailto:[email protected]]
Posted At: Friday, May 13, 2005 1:53 AM
Posted To: microsoft.public.infopath
Conversation: Increment number
Subject: Re: Increment number

Thanks Alex !
Yes I thought that writing a webservice would be the preferred solution.
The
problem is that I do not know how to do that... Sorry for being a rookie
on
this :)
Could you post a URL or something that describes how to do it?
Many thanks!
/Lise

Alex said:
Lise,

There are three ways to approach your scenario:

1. During save, write this last used ID to a local file. Your solution
needs to be fully trusted or you will get a security warning based on
the zone.

2. Have a custom task pane and use IE's one of the many storage
mechanisms (e.g. userdata, cookie etc)

3. Write a web service and use secondary data source to query it for the
current order number.

I would recommend #3 as the most robust mechanism, especially if the
customer plans to roll out the form to several data entry persons (order
number generation process needs to be synchronized - a web service is
perfect for that).

Let me know if you need more help!

Good luck,
Alex @ Microsoft



-----Original Message-----
From: Lise [mailto:[email protected]]
Posted At: Tuesday, May 10, 2005 11:59 PM
Posted To: microsoft.public.infopath
Conversation: Increment number
Subject: Re: Increment number

Hi Alex,

Thank you for your answer. Let me explain the entire scenario:
I have a customer who wants to use InfoPath for their Flight Requests
and
they want an ordernumber to be created automatically by InfoPath. We do
not
use any data source in this form, but we would like to be able to export
it
to Axapta later on (if needed). So when the user creates a request, the
ordernumber is filled in automatically with a structure like "FR-0001".
Is
this possible? The best thing would be to have an external file that is
updated, but I do not know how to accomplish that.
Thank you very much!
/Lise


Alex said:
Lise,

You can automatically generate order numbers on the database side. For
example, if you want to auto-increment PurchaseOrderID in the Orders
table, create a primary key for PurchaseOrderID that would
autoincrement, and create an InfoPath form template that allows
users
to
submit order details. In that form, users won't have to specify the
order number - and you don't need to worry about generating one. All
will be done on the database side.

If this doesn't work for you, please tell me more about your scenario;
why do you need to create a purchase order number on the client side?

Good luck,
Alex @ Microsoft

-----Original Message-----
From: Lise [mailto:[email protected]]
Posted At: Tuesday, May 10, 2005 4:02 AM
Posted To: microsoft.public.infopath
Conversation: Increment number
Subject: Increment number

Hello,
I have searched this forum for an answer, but all I can find is
questions
regarding this issue - not solutions. What I want is an autogenerated
ordernumber that increments with +1 when opened and saved. What is the
best
solution to accomplish this?
I am new to VBscript, and C# and all other Microsoft programming
language.
Thank you very much!

/Lise
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top