Preventing from auto generate ID

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Preventing from auto generate ID

Vinayak Yadav
Hi,
i an new in ofbiz
I have created one page for student information
It has two fields ID and Description
I don't want to auto generate ID
When we run the application it shows two text boxes to enter the
student id and description
but when we click on submit it gives an error
attached the hello3 example
Please help me

Thanks
Vinayak

hello3.zip (31K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

awdesh parihar
Hello Vinayak

  please put error message you are getting.

--
--
Awdesh Parihar
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

matarazzo angelo
In reply to this post by Vinayak Yadav
Hi,
why dou you use java?
I recommend you to use entity-auto engine and xml-form.
Look at example component in framework/example.
I hope to have helped you.
Vinayak Yadav wrote
Hi,
i an new in ofbiz
I have created one page for student information
It has two fields ID and Description
I don't want to auto generate ID
When we run the application it shows two text boxes to enter the
student id and description
but when we click on submit it gives an error
attached the hello3 example
Please help me

Thanks
Vinayak

 
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

BJ Freeman
In reply to this post by Vinayak Yadav
you would use
      delegator.getNextSeqId("yourIDname");
to auto create.
other wise you need to check the value of the ID field before you  store
the information.

Vinayak Yadav sent the following on 10/21/2008 4:17 AM:

> Hi,
> i an new in ofbiz
> I have created one page for student information
> It has two fields ID and Description
> I don't want to auto generate ID
> When we run the application it shows two text boxes to enter the
> student id and description
> but when we click on submit it gives an error
> attached the hello3 example
> Please help me
>
> Thanks
> Vinayak
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Vinayak Yadav
Thanks,


I don't want use the function delegator.getNextSeqId("yourIDname"); to
generate ID
I want to enter the ID
Please Help me
>>
>> Thanks
>> Vinayak
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Sumit Pandit-3
Try it :

Instead

  String helloPersonId = delegator.getNextSeqId("HelloPerson");

use

String helloPersonId = "student01". // or whatever you want as Id


--
Thanks and Regards
Sumit Pandit.
HotWaxMedia, Inc
http://www.hotwaxmedia.com

On Oct 22, 2008, at 10:50 AM, Vinayak Yadav wrote:

> Thanks,
>
>
> I don't want use the function delegator.getNextSeqId("yourIDname"); to
> generate ID
> I want to enter the ID
> Please Help me
>>>
>>> Thanks
>>> Vinayak
>>

Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Vinayak Yadav
Dear user,

how to access the id which is entered in the text box on screen?

i want to store that id (not hard coded in code).

thanks for reply.
vinayak

On Wed, Oct 22, 2008 at 10:55 AM, Sumit Pandit
<[hidden email]> wrote:

> Try it :
>
> Instead
>
>  String helloPersonId = delegator.getNextSeqId("HelloPerson");
>
> use
>
> String helloPersonId = "student01". // or whatever you want as Id
>
>
> --
> Thanks and Regards
> Sumit Pandit.
> HotWaxMedia, Inc
> http://www.hotwaxmedia.com
>
> On Oct 22, 2008, at 10:50 AM, Vinayak Yadav wrote:
>
>> Thanks,
>>
>>
>> I don't want use the function delegator.getNextSeqId("yourIDname"); to
>> generate ID
>> I want to enter the ID
>> Please Help me
>>>>
>>>> Thanks
>>>> Vinayak
>>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Vinayak Yadav
In reply to this post by BJ Freeman
How to check the value of the ID field before storing the information.

Thanks

On Wed, Oct 22, 2008 at 2:33 AM, BJ Freeman <[hidden email]> wrote:

> you would use
>      delegator.getNextSeqId("yourIDname");
> to auto create.
> other wise you need to check the value of the ID field before you  store
> the information.
>
> Vinayak Yadav sent the following on 10/21/2008 4:17 AM:
>> Hi,
>> i an new in ofbiz
>> I have created one page for student information
>> It has two fields ID and Description
>> I don't want to auto generate ID
>> When we run the application it shows two text boxes to enter the
>> student id and description
>> but when we click on submit it gives an error
>> attached the hello3 example
>> Please help me
>>
>> Thanks
>> Vinayak
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

awdesh parihar
Hi Vinayak

 Please give some detail of your application you want to develop ,it will
help us to understand your problem.


--
--
Awdesh Parihar
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Vinayak Yadav
I am a developing a portal web site
but before that i want to prepare for ofbiz framework
so that i have created a student screen
instead of generating ID i want enter it on screen
and how to access ID entered in text box on screen in coding

Thanks

On Wed, Oct 22, 2008 at 11:22 AM, awdesh parihar
<[hidden email]> wrote:

> Hi Vinayak
>
>  Please give some detail of your application you want to develop ,it will
> help us to understand your problem.
>
>
> --
> --
> Awdesh Parihar
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

BJ Freeman
In reply to this post by Vinayak Yadav
it would be best if you went thru
http://docs.ofbiz.org/display/OFBIZ/OFBiz+Beginner%27s+Development+Guide+Using+Practice+Application
it will not answer directly what you want to know but would make it
easier to communicate.
you can create a simple service or a java service that create student.
it would copy create person, and add the partyID, so you can pass it in,
then add a role type of Student.
Strange I remember having the partyID as a in var in create person, I
think someone removed it.


Vinayak Yadav sent the following on 10/21/2008 10:42 PM:

> How to check the value of the ID field before storing the information.
>
> Thanks
>
> On Wed, Oct 22, 2008 at 2:33 AM, BJ Freeman <[hidden email]> wrote:
>> you would use
>>      delegator.getNextSeqId("yourIDname");
>> to auto create.
>> other wise you need to check the value of the ID field before you  store
>> the information.
>>
>> Vinayak Yadav sent the following on 10/21/2008 4:17 AM:
>>> Hi,
>>> i an new in ofbiz
>>> I have created one page for student information
>>> It has two fields ID and Description
>>> I don't want to auto generate ID
>>> When we run the application it shows two text boxes to enter the
>>> student id and description
>>> but when we click on submit it gives an error
>>> attached the hello3 example
>>> Please help me
>>>
>>> Thanks
>>> Vinayak
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

BJ Freeman
In reply to this post by Vinayak Yadav
if you follow the createperson screen thru the contoller to the service
you will have a good idea about how to do this.
the only thing you need todo in your createstudent service is add the
input for partyID.

Vinayak Yadav sent the following on 10/21/2008 10:56 PM:

> I am a developing a portal web site
> but before that i want to prepare for ofbiz framework
> so that i have created a student screen
> instead of generating ID i want enter it on screen
> and how to access ID entered in text box on screen in coding
>
> Thanks
>
> On Wed, Oct 22, 2008 at 11:22 AM, awdesh parihar
> <[hidden email]> wrote:
>> Hi Vinayak
>>
>>  Please give some detail of your application you want to develop ,it will
>> help us to understand your problem.
>>
>>
>> --
>> --
>> Awdesh Parihar
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

awdesh parihar
Hi vinayak

you can get id value from parameters ,I think id value will be available in
parameters .

--
--
Awdesh Parihar
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Sumit Pandit-3
In reply to this post by Vinayak Yadav


  try {
            // String helloStudId =  
delegator.getNextSeqId("HelloStud"); // gets next available key for  
HelloPerson
             //Debug.logInfo("helloStudId = " + helloStudId,  
module); // prints to the console or console.log
             GenericValue helloStud = delegator.makeValue("HelloStud",
                     UtilMisc.toMap("helloStudId", helloStudId)); //  
create a GenericValue from ID we just got
            helloTest.setPKFields(context); // move primary key fields  
from input parameters to GenericValue

// here make sure that context must contain a key with same name as  
primary key of the Entity.

            helloTest.setNonPKFields(context); // move non-primary key  
fields from input parameters to GenericValue
             delegator.create(helloStud); // store the generic value,  
ie persists it

             Map result = ServiceUtil.returnSuccess(); // gets  
standard Map for successful service operations
             result.put("helloStudId", helloStudId); // puts output  
parameter into Map to return
             return result; // return Map
         } catch (GenericEntityException ex) { // required if you use  
delegator in Java
             return ServiceUtil.returnError(ex.getMessage());
         }



--
Thanks and Regards
Sumit Pandit.
HotWaxMedia, Inc
http://www.hotwaxmedia.com

On Oct 22, 2008, at 11:12 AM, Vinayak Yadav wrote:

> How to check the value of the ID field before storing the information.
>
> Thanks
>
> On Wed, Oct 22, 2008 at 2:33 AM, BJ Freeman <[hidden email]>  
> wrote:
>> you would use
>>     delegator.getNextSeqId("yourIDname");
>> to auto create.
>> other wise you need to check the value of the ID field before you  
>> store
>> the information.
>>
>> Vinayak Yadav sent the following on 10/21/2008 4:17 AM:
>>> Hi,
>>> i an new in ofbiz
>>> I have created one page for student information
>>> It has two fields ID and Description
>>> I don't want to auto generate ID
>>> When we run the application it shows two text boxes to enter the
>>> student id and description
>>> but when we click on submit it gives an error
>>> attached the hello3 example
>>> Please help me
>>>
>>> Thanks
>>> Vinayak
>>

Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Vinayak Yadav
I tried following code but it is not working. It is giving error while
compiling.
Please Help Us.

Thanks


try {
          // String helloStudId = delegator.getNextSeqId("HelloStud");
// gets next available key for HelloPerson
           //Debug.logInfo("helloStudId = " + helloStudId, module); //
prints to the console or console.log
           GenericValue helloStud = delegator.makeValue("HelloStud",
                   UtilMisc.toMap("helloStudId", helloStudId)); //
create a GenericValue from ID we just got
          helloTest.setPKFields(context); // move primary key fields
from input parameters to GenericValue

// here make sure that context must contain a key with same name as
primary key of the Entity.

          helloTest.setNonPKFields(context); // move non-primary key
fields from input parameters to GenericValue
           delegator.create(helloStud); // store the generic value, ie
persists it

           Map result = ServiceUtil.returnSuccess(); // gets standard
Map for successful service operations
           result.put("helloStudId", helloStudId); // puts output
parameter into Map to return
           return result; // return Map
       } catch (GenericEntityException ex) { // required if you use
delegator in Java
           return ServiceUtil.returnError(ex.getMessage());

       }
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Chirag Manocha-2
Vinayak,
Please copy the error from your console and post here, which will be
better to helping you out.

Regards

Chirag Manocha
HotWax Media
http://www.hotwaxmedia.com
============================
Email   :- [hidden email]
Contact :- +91-982-631-9099



Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Sumit Pandit-3
In reply to this post by Vinayak Yadav
If you are provide error message also then it will be helpful.
Also please try to provide much information with the problem.


--
Thanks and Regards
Sumit Pandit.
HotWaxMedia, Inc
http://www.hotwaxmedia.com

On Oct 22, 2008, at 2:40 PM, Vinayak Yadav wrote:

> I tried following code but it is not working. It is giving error while
> compiling.
> Please Help Us.
>
> Thanks
>
>
> try {
>          // String helloStudId = delegator.getNextSeqId("HelloStud");
> // gets next available key for HelloPerson
>           //Debug.logInfo("helloStudId = " + helloStudId, module); //
> prints to the console or console.log
>           GenericValue helloStud = delegator.makeValue("HelloStud",
>                   UtilMisc.toMap("helloStudId", helloStudId)); //
> create a GenericValue from ID we just got
>          helloTest.setPKFields(context); // move primary key fields
> from input parameters to GenericValue
>
> // here make sure that context must contain a key with same name as
> primary key of the Entity.
>
>          helloTest.setNonPKFields(context); // move non-primary key
> fields from input parameters to GenericValue
>           delegator.create(helloStud); // store the generic value, ie
> persists it
>
>           Map result = ServiceUtil.returnSuccess(); // gets standard
> Map for successful service operations
>           result.put("helloStudId", helloStudId); // puts output
> parameter into Map to return
>           return result; // return Map
>       } catch (GenericEntityException ex) { // required if you use
> delegator in Java
>           return ServiceUtil.returnError(ex.getMessage());
>
>       }

Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Vinayak Yadav
Thanks Sumit

can i get the function defination for following function

delegator.getNextSeqId("HelloStud");

Thanks again.

On Wed, Oct 22, 2008 at 6:49 PM, Sumit Pandit
<[hidden email]> wrote:

> If you are provide error message also then it will be helpful.
> Also please try to provide much information with the problem.
>
>
> --
> Thanks and Regards
> Sumit Pandit.
> HotWaxMedia, Inc
> http://www.hotwaxmedia.com
>
> On Oct 22, 2008, at 2:40 PM, Vinayak Yadav wrote:
>
>> I tried following code but it is not working. It is giving error while
>> compiling.
>> Please Help Us.
>>
>> Thanks
>>
>>
>> try {
>>         // String helloStudId = delegator.getNextSeqId("HelloStud");
>> // gets next available key for HelloPerson
>>          //Debug.logInfo("helloStudId = " + helloStudId, module); //
>> prints to the console or console.log
>>          GenericValue helloStud = delegator.makeValue("HelloStud",
>>                  UtilMisc.toMap("helloStudId", helloStudId)); //
>> create a GenericValue from ID we just got
>>         helloTest.setPKFields(context); // move primary key fields
>> from input parameters to GenericValue
>>
>> // here make sure that context must contain a key with same name as
>> primary key of the Entity.
>>
>>         helloTest.setNonPKFields(context); // move non-primary key
>> fields from input parameters to GenericValue
>>          delegator.create(helloStud); // store the generic value, ie
>> persists it
>>
>>          Map result = ServiceUtil.returnSuccess(); // gets standard
>> Map for successful service operations
>>          result.put("helloStudId", helloStudId); // puts output
>> parameter into Map to return
>>          return result; // return Map
>>      } catch (GenericEntityException ex) { // required if you use
>> delegator in Java
>>          return ServiceUtil.returnError(ex.getMessage());
>>
>>      }
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Chirag Manocha-2
Hello Vinayak,
Just check it in the GenericDelegator.java

Regards

Chirag Manocha
HotWax Media
http://www.hotwaxmedia.com
============================
Email   :- [hidden email]
Contact :- +91-982-631-9099



Reply | Threaded
Open this post in threaded view
|

Re: Preventing from auto generate ID

Sumit Pandit-3
In reply to this post by Vinayak Yadav
Vinayak,

As you are a Java programmer. so to see definition of any function you  
can take the help of java doc. And for doc please search it on google  
(a good search engine) :)

--
Thanks and Regards
Sumit Pandit.
HotWaxMedia, Inc
http://www.hotwaxmedia.com

On Oct 23, 2008, at 10:27 AM, Vinayak Yadav wrote:

> Thanks Sumit
>
> can i get the function defination for following function
>
> delegator.getNextSeqId("HelloStud");
>
> Thanks again.
>
> On Wed, Oct 22, 2008 at 6:49 PM, Sumit Pandit
> <[hidden email]> wrote:
>> If you are provide error message also then it will be helpful.
>> Also please try to provide much information with the problem.
>>
>>
>> --
>> Thanks and Regards
>> Sumit Pandit.
>> HotWaxMedia, Inc
>> http://www.hotwaxmedia.com
>>
>> On Oct 22, 2008, at 2:40 PM, Vinayak Yadav wrote:
>>
>>> I tried following code but it is not working. It is giving error  
>>> while
>>> compiling.
>>> Please Help Us.
>>>
>>> Thanks
>>>
>>>
>>> try {
>>>        // String helloStudId = delegator.getNextSeqId("HelloStud");
>>> // gets next available key for HelloPerson
>>>         //Debug.logInfo("helloStudId = " + helloStudId, module); //
>>> prints to the console or console.log
>>>         GenericValue helloStud = delegator.makeValue("HelloStud",
>>>                 UtilMisc.toMap("helloStudId", helloStudId)); //
>>> create a GenericValue from ID we just got
>>>        helloTest.setPKFields(context); // move primary key fields
>>> from input parameters to GenericValue
>>>
>>> // here make sure that context must contain a key with same name as
>>> primary key of the Entity.
>>>
>>>        helloTest.setNonPKFields(context); // move non-primary key
>>> fields from input parameters to GenericValue
>>>         delegator.create(helloStud); // store the generic value, ie
>>> persists it
>>>
>>>         Map result = ServiceUtil.returnSuccess(); // gets standard
>>> Map for successful service operations
>>>         result.put("helloStudId", helloStudId); // puts output
>>> parameter into Map to return
>>>         return result; // return Map
>>>     } catch (GenericEntityException ex) { // required if you use
>>> delegator in Java
>>>         return ServiceUtil.returnError(ex.getMessage());
>>>
>>>     }
>>
>>