Fetch data from other fields, save it and show it in another field (965 Views)
Reply
Trusted Contributor
SanjeevDas
Posts: 385
Registered: ‎06-17-2013
Message 1 of 12 (965 Views)

Fetch data from other fields, save it and show it in another field

HI Experts,

Good Day.

 

I have a form chg.autoassignment related to a table chgautoassignment. The form chg.autoassignment contains the fields like division(dropdown), category(linked with the cm3rcategory name field), subcategory(linked with the cm3rsubcat subcategory field).

There is another field named as "supercat" which will take up the data from the above mentioned fields, save it and show the data in the format division > category > subcategory as soon the user clicks on Add or Save button.

 

So while performing a search on the form, the data in the form will look like,

 

Division : myDivision

Category: Hardware

SubCategory: Computer

SuperCat: myDivision > Hardware > Computer

 


Few fields may add up later, but if I can show the data for the SuperCat in the above mentioned format, then I am sure I can do it for additional fields also.

 

Can anyone please help me with this?
Any help will be appreciated.

 

Thanks and Best regards,

Sanjeev

Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 2 of 12 (943 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi Sanjeev,

First of all data never saves in format, it always go to respective dbdict (table) and display data on from depending on field made visible or FC calculations.

So here , if i am no wrong, you have data displayed on form and just need to add in to new field with some format.
So you should add calculations in 'chgautoassignment' fc as below,
update : true
add : true
calculation :
SuperCat in $file= Division in$file + Category in$file + SubCategory in$file


hth,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Trusted Contributor
SanjeevDas
Posts: 385
Registered: ‎06-17-2013
Message 3 of 12 (935 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi Piku,

 

chgautoassignment was initially not defined in FC.

So first I defined chgautoassignment in fc and added the calculation as:

 

update : true
add : true
calculation :
SuperCat in $file= Division in $file + Category in $file + SubCategory in $file

 

SuperCat is defined in dbdict to save the formated data from .

 

Unfortunately the data in format doesn't get saved after I click on add.

 

Please help.

Thanks,

Sanjeev

 

Honored Contributor
Abhijit K
Posts: 903
Registered: ‎10-14-2010
Message 4 of 12 (925 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi,

Could u please add Division, Category and SubCategory data first and then try to save it.

whatever suggested by piku is correct and shud work.

Re,
Abhijit K
Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 5 of 12 (915 Views)

Re: Fetch data from other fields, save it and show it in another field

Are you getting values in other three fields after save. Paste your fc snap shot and form snap shot with value filled.
Also cross check there is no type error in filed name in fd.

hth,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Trusted Contributor
SanjeevDas
Posts: 385
Registered: ‎06-17-2013
Message 6 of 12 (899 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi Piku,

 

The division, category and the subcategory fields are getting saved in the database. Even the values from categorystructure field is also getting saved in database. I have checked, the data from all the fields in the chg.autoassignment form is getting saved in the database.

Please check the required snapshot

 

The chgautoassignment table

chgauto_table.jpg

 

The chgautoassignment form

chgauto_form.jpg

 

chgautoassignment fc

chgauto_fc.jpg

 

chgauto_fc1.jpg

chgauto_fc2.jpg

Please have a look on the above snapshots and let me know if I am going wrong somewhere.

$file means read data from the form, what if I want to read the data from the database and add the data and display in the field, shall I replace the $file with something else.

One thing I couldnot understand what is type error in field name in fd?

 

Thanks,

Sanjeev

 

 

Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 7 of 12 (891 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi Sanjeev,

All is fine. $file represents the current file data which is what you see o form.
It is possible your fc is not calling.
You have posted two different FC, calculation must be in 'chgautoassignment' but as per snap shot you have it in 'itchgautoassignment'.
Check it.
if no master fc exists then may create a new one and associate it with table.

hth,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Trusted Contributor
SanjeevDas
Posts: 385
Registered: ‎06-17-2013
Message 8 of 12 (887 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi Piku,

 

chgautoassignment got renamed to itcchgautoassignment. So everything relating chgautoassignment got renamed to itcchgautoassignment as per our client's request. Ofcourse a new table has been created for that.

The fc is itcchgautoassignment.

Does creating a new fc automatically assigns it to the table?

For e.g I created new fc itcchgautoassignment, so does it automatically gets linked with the table itcchgautoassignment or do we need to link fc with a table manually.

 

Thanks,

Sanjeev

Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 9 of 12 (881 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi,

You need not to assign table name but safer side can do that.
Something is missing. post again you all snaps of using objects. Post snap of dbdict showing fields.

hth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Trusted Contributor
SanjeevDas
Posts: 385
Registered: ‎06-17-2013
Message 10 of 12 (876 Views)

Re: Fetch data from other fields, save it and show it in another field

 Hi Piku,

 

The itcchgautoassignment table

chgauto_table.jpg

 

The itcchgautoassignment dbdict

chgauto_dbdict.JPG

 

 

The itc.chgautoassignment form

chgauto_form.jpg

 

itcchgautoassignment fc

 

 

chgauto_fc1.jpg

chgauto_fc2.jpg

Please have a look on the above snapshots and let me know if I am going wrong somewhere.

Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 11 of 12 (870 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi,

All is fine.
Did you tried to save something manually in 'itc.catstructure' field on form. try it.
What is table (backend) name for this field , check in dbdict.
Also cross check fd for this field whether you have put correct input property name.
Also check whether you have any other calculation for this field on fc or somewhere else.

hth,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Trusted Contributor
SanjeevDas
Posts: 385
Registered: ‎06-17-2013
Message 12 of 12 (858 Views)

Re: Fetch data from other fields, save it and show it in another field

Hi Piku,

 

The data from itc.catstructure field is getting stored in the database.  Backend table name from the table itcchgautoassignment is "ITCCHGAUTOASSIGNMENTM1".

 

The Catsturcture field in form designer

chgauto_catstruct_att.JPG

 

itc.catstructure is the new field that I have designed. So it is only assocaited with the fc itcchgautoassignment.

 

Thanks,

Sanjeev

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.