Hexagon Geospatial
MENU

GeoMedia Smart Client

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
bw
Occasional Contributor
Posts: 11
Registered: ‎05-06-2016
Accepted Solution

Refreshing session key trigger.

Hi.

 

I have two object in realation one to many. I'm trying to implement functionaly of adding new parent object to list. I have following FormSettings:

<Form name="KARTAOBCHODU" table="KARTAOBCHODU" idfield="ID">
		<FormTab name="KARTAOBCHODU_Tab" label=" ">
			<FormGroup name="KARTAOBCHODU_Group" label=" ">
				<FormField name="ID" label="ID:" type="textfield" datatype="number" required="false" visible="true" maxlength="22"/>
				<FormField name="BOCZNICA" label="BOCZNICA:" type="textfield" datatype="string" required="false" maxlength="200" visible="form,list,filter"/>
				<FormField name="NUMER" label="NUMER:" type="textfield" datatype="string" required="false" maxlength="100" visible="form,list,filter"/>
				<FormField name="DATA" label="DATA:" type="textfield" datatype="timestamp" required="false" maxlength="20"/>
				<FormField name="UWAGI" label="UWAGI:" type="textfield" datatype="string" required="false" maxlength="1000"/>
				<FormField name="STATUS" label="STATUS:" type="textfield" datatype="string" required="false" maxlength="50"/>
				<FormFile name="ZALACZNIK" label="ZALACZNIK:" datatype="file" uploaddir="C:\GMSC_warehouse\WorkflowFiles\{FORM.ID}"/>
				<FormTable name="ELEMENTY_TABELA" label="Szczegóły  obchodu:" persisted="false"  
				lov="SQL[select d.id, z.ID as KOBRAKIID, z.KOID, z.NRROZTORU, z.DATAOGLEDZIN, z.OPIS, z.ZADANIENAPRAWY, z.OSOBA
				from KARTAOBCHODU d, KOBRAKI z where d.ID=z.KOID and d.ID={FORM.ID} order by z.DATAOGLEDZIN ASC]" idfield="ID" visible="hidden[SCRIPT[IG.hasValue({FORM.ID})]]"> 
					<FormTableField name="KOBRAKIID" label="ID"/>
					<FormTableField name="NRROZTORU" label="Nr. rozjazdu/toru"/>	
					<FormTableField name="DATAOGLEDZIN" label="Data i godzina oględzin" datatype="timestamp"/>
					<FormTableField name="OPIS" label="Braki i uszkodzenia"/>
					<FormTableField name="ZADANIENAPRAWY" label="Zlecenia naprawy"/>
					<FormTableField name="OSOBA" label="Osoba podpsiująca"/>
					
					 <FormAction name="EDIT_OGLEDZINY" label="Edit sub-object"
					action="SCRIPT[IG.trigger({triggerNames:['SESSION'],urlParams:{rowId:{ROW.KOBRAKIID}}}).done(function(result)
					{IG.openSimpleModalForm({
					form:'KOBRAKI',
					id:{ROW.KOBRAKIID}, 
					closeAction: 'reloadFields', 
					closeActionParam:['ELEMENTY_TABELA']
					});})]" 
					type="row" image="ig-icon-edit"/>				
					
          			
          			<FormAction name="Delete" label="Usuń" 
                      action="SCRIPT[IG.trigger({triggerNames:['USUN_KOBRAKI'],urlParams:{kobrakiId:{ROW.KOBRAKIID}}}).done(function() {IG.reloadPage();})]" 
                      type="row" image="ig-icon-delete" />
					  
          			<FormAction name="Add" label="Add new sub-object"
					action="SCRIPT[IG.trigger({triggerNames:['SESSION'],urlParams:{rowId:11}}).done(function(result)
					{IG.openSimpleModalForm({
					form:'KOBRAKI',
					id:11, 
					closeAction: 'reloadFields', 
					closeActionParam:['ELEMENTY_TABELA']
					});})]" 
					type="form" image="ig-icon-add"/>					
					
				</FormTable>
			</FormGroup>	
				<FormAction name="Save_form" label="Zapisz" visible="form" type="form" action="save" />		
				
		</FormTab>
									<!--### HERE I HAVE TROUBLE ####-->		
						<FormAction name="Add_form" label="Dodaj nowy obiekt!" visible="list"
						action="SCRIPT[IG.navigate({form:'KARTAOBCHODU', emptyform:true, closeAction:'reloadPage'})]" 
						type="form" image="ig-icon-add"/>
					<!-- i was trying also things like this:-->
					 <FormAction name="Add_form2" label="Dodaj nowy obiekt" visible="list"
						action="SCRIPT[IG.trigger({triggerNames:['AddKarta']}).done(function(result){ 						
						IG.navigate('KO_szczegoly');
						})]" 
						type="form" image="ig-icon-add"/>
						<!-- and many other -->
							
	</Form>

here is workflowSettings:

<?xml version="1.0" encoding="UTF-8" ?>
<WorkflowRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../XSD/Workflows/WorkflowSettings.xsd">
	<WorkflowNode id="KO_lista" label="Zestawienie kart obchodów" form="KARTAOBCHODU" controller="list">
		<WorkflowNode id="KO_szczegoly" label="Zawartość karty obchodu" form="KARTAOBCHODU" controller="form" follownode="KO_lista">
			<WorkflowTrigger name="DODAJ_OGLEDZINY" type="SqlTrigger" method="action">
					<Param name="Sql" value="Insert into KOBRAKI (ID,KOID) 
					select KOBRAKIID162.nextval, ID from KARTAOBCHODU where ID={REQUESTCONTEXT.FormId}"/>
			</WorkflowTrigger>
			<WorkflowTrigger name="SESSION" method="action" type="SessionTrigger">
					<Param name="Key" value="CUPRUM.KOBRAKI.ID"/>
					<Param name="Value" value="Sql[Select ID from KOBRAKI where ID={REQUESTCONTEXT.rowID}]"/>
			</WorkflowTrigger>
			<WorkflowTrigger name="RemoveSessionTrigger" type="RemoveSessionTrigger" method="after">
  					<Param name="Key" value="CUPRUM.KOBRAKI.ID"/>
			</WorkflowTrigger>		
			<WorkflowTrigger name="USUN_KOBRAKI" method="action" type="SqlTrigger">
				<Param name="Sql" value="Delete from KOBRAKI where ID ={REQUESTCONTEXT.kobrakiId}"/>
			</WorkflowTrigger>	
		</WorkflowNode>
		
		<WorkflowTrigger name="AddKarta" method="action" type="SqlTrigger">
				<Param name="Sql" value="insert into CUPRUM.kartaobchodu (ID) values (CUPRUM.KARTAOBCHOID161.NEXTVAL)"/>
		</WorkflowTrigger>
		<!-- this is problematic trigger, i was trying other ways of defining him-->
		<WorkflowTrigger name="GetCurrentKartaId" method="after" type="SessionTrigger"> 
				<Param name="Key" value = "CUPRUM.KARTAOBCHODU.ID"/>
				<Param name="Value" value="Sql[select CUPRUM.KARTAOBCHOID161.NEXTVAL from dual]"/>
		</WorkflowTrigger>
	</WorkflowNode>
	<WorkflowNode id="KO_Ogledziny" label="Szczegóły oględzin karty obchodu" form="KOBRAKI" controller="form" follownode="KO_szczegoly">
	
		<WorkflowTrigger name="ZAPISZ_KOBRAKI" type="SqlTrigger" method="action">
		<Param name="Sql" value="update kobraki set ID= {REQUESTCONTEXT.id}, KOID={REQUESTCONTEXT.koid}, NRROZTORU={REQUESTCONTEXT.nrRoz}, DATAOGLEDZIN={REQUESTCONTEXT.dataOgl}, OPIS={REQUESTCONTEXT.opis}, ZADANIENAPRAWY={REQUESTCONTEXT.zadanie}, OSOBA={REQUESTCONTEXT.osoba}} "/>
		</WorkflowTrigger>
	</WorkflowNode>
	
</WorkflowRoot>


The problem is:
1) if i am trying to add new object using simpleModalform i can not send ID for new parentObject (so user have to pass it manually) and i can not save this object because the error about missing domainObject is thrown
2) if i am trying to add new object using trigger that is creating new parent ID object and storing it's ID in session and then IG.navigate or redirect the session object is the same as the last one.

What i am doing wrong?

Regards, 
Bartek

Staff
Posts: 1,033
Registered: ‎10-18-2015

Re: Refreshing session key trigger.

Hi Bartek,

 

it's quite difficult to analyze what you need, but in general what you have to do is to store the primary key in the session as [TABLENAME].[PKNAME] (please check if you are always using or not the schema identifier). So basically if your objects are in the same table just replacing the value in the session will do the work. If you are working on different tables you have also to change the active feature, because in the session you will have stored 2 primary key information, for both tables.

Also please check the triggers AddKarta and GetCurrentKartaId because it seems you are generating new different values in both of them.

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
bw
Occasional Contributor
Posts: 11
Registered: ‎05-06-2016

Re: Refreshing session key trigger.

Hi,

 

Thank you for your help, it helped us indeed. Do you know of any avaible 'tutorials' for this kind of work like creating new objectcs, passing arguments to another windows etc? I was reading API documentation from top to bottom but information like "IG.setActiveFeature(activeFeature) Sets the active feature in Smart Client. The active feature may be set using the name or the ID of the feature" is a bit laconic for a newbie like me.

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.