how to populate variables with custom tables columns

madhvi
Giga Contributor

i have created one custom table with columns:city,location,name,schedule.Name is made as display   true.

i want to populate all values in a catalog item with variables city,location,name,schedule respectively.

All variables are reference type on that custom table.only name is having correct value.how to populate other columns in the respective variable.

Is this doable?

3 REPLIES 3

Chuck Tomasi
Tera Patron

Hi Madvi,



I'm not sure I understand what the problem is you are trying to solve. The whole purpose of a reference field is so you can "point to" a record in another table. If you have the "name" field referencing a specific record, then you have access to the other values on that record (city, location, schedule). Having them on the form is a bit like using the caller on an incident, but then having separate fields (not even dot-walking) to phone, location, company, etc. Why take up the space? Why add the extra effort to update all that information.



Yes, this can be done, I'm not sure I understand the value to the user or the cost of doing it.



(Always ask them "why", then ask again and again and again.)


Abhinay Erra
Giga Sage

Madhvi,



        Only "Name" variable should be of reference type to custom table. Rest should be a single line text type


Then, write an onChange client script on the name variable and add below script in the onChange function



var namevar = g_form.getReference('variable name of Name', doAlert); // doAlert is our callback function



function doAlert(namevar) { //reference is passed into callback as first arguments


g_form.setValue('variable name of city',namevar.<field_name of city on custom table>);


g_form.setValue('variable name of schedule',namevar.<field_name of schedule on custom table>);


g_form.setValue('variable name of location',namevar.<field_name of location on custom table>);


}




Thanks,


Abhinay



PS: Hit like, Helpful or Correct depending on the impact of the response


Hi Abhinav,



Name variable is list collector type,as user wants to select multiple options in one form.



Thanks


madhvi