cancel
Showing results for 
Search instead for 
Did you mean: 

Save Extension Field

0 Kudos

Hi Experts

I have added an Extension Field to an RFX which I go count the number of RFx Responses and display it on screen. My problem is how do I save that same value on the database so I can read it from a Query. The script Target is on "Loaded".

supcolln = doc.getProposals();

number = supcolln.size();

doc.getExtensionField("EXT_Supplier_Count").set(number);

How do I get to save the set value to the database.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member190023
Contributor
0 Kudos

Hi,

You should just move your exact code from 'Loaded' to 'Validate' script.

PS: if the only purpose of this is the query result, you can do the calculation directly in the query without the need of an extension field.

Bogdan

0 Kudos

Hi Bogdan

I think the idea of getting it directly from the query result is a perfect one. May you please assist of how the code on the result field be constructed.

Regards

former_member190023
Contributor
0 Kudos

? ... COUNT

( SELECT COUNT(*)

   FROM {rfx response table} frr

   WHERE frr.PARENT_OBJECT_ID = {parent alias}.OBJECTID )

this is the most simple form ... you should query as per your specific requirements.

Bogdan

0 Kudos

Works like a charm. Thank you very much

Answers (2)

Answers (2)

Former Member
0 Kudos

HI

supcolln = doc.getProposals();

number = supcolln.size();

doc.getExtensionField("EXT_Supplier_Count").set(number);

doc.upgradeToEdit(doc);

doc.save(doc);

doc.downgradeToView(doc);

former_member190023
Contributor
0 Kudos

this proposal is REALLY BAD! ... you should never 'save' any document on a Loaded event script! (if you want the system to work)

Bogdan

former_member227405
Participant
0 Kudos

Hi Mashimbye

Once you create an extension field for any Document , the data base referance for that field gets cretaed automatically.

You can check the data base field name by opening any query and under Report(right most )there will be "Browse Extension schema" and once you open that you will get all the extension corresponding field  in  you respective doctype.

And you can get those filed value by belwo query.

SELECT

<%RESULTS%>

FROM

<%SCHEMA%>.FCI_RFX_DOC  T1

LEFT OUTER JOIN

<%EXT_TABLE(rfx.RFXDoc)%> EXT1

ON (T1.OBJECTID = EXT1.PARENT_OBJECT_ID)

Under result file

Coloumn Id:EXT1.EXT_Supplier_Coun.(EXT_Supplier_Coun is the corresponding data base field)

Hope this will hep you.

Thanks

Sonu