# Need help in SFC functional flow modification

**URL:** <https://forum.inductiveautomation.com/t/need-help-in-sfc-functional-flow-modification/93001>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 10, 2024, 10:38am UTC](https://forum.inductiveautomation.com/t/need-help-in-sfc-functional-flow-modification/93001 "2024-07-10T10:38:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [July 10, 2024, 10:38am UTC](https://forum.inductiveautomation.com/t/need-help-in-sfc-functional-flow-modification/93001/1 "2024-07-10T10:38:47Z")

</div>

I am working with "Recipe Management Exchange project" available in ignition exchange, I need to do modification in that project.  
Let me explain the flow, It has two function, F1 and F2.  
F1 function will flow from one step to next according to the time what we are given  
F2 will work as, a pop up will come, I need to enter text and confirm so it will move to next step.  
What I need is, I want F1 function to run for given time like 15 secs, when 15 secs ends, one pop up should come and in that I need to give "OK" to move on next stage.

 ![Screenshot 2024-07-10 155806](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/2/22562844b726b3e884e8efdd3d4ef7f49e661a32.png)

custom.starttime= Time process started.  
custom.endtime = Time in which each process ends.

What I have Tired,  
I have tired to implement, change script in custom.endtime , but throws the error as "It should be in INT/STRING not in DATE".

```python
if currentValue.value is not None:
			
			
			
			#open the step 7 popup if the chart is running.
			if self.custom.function==3 and self.custom.currentID is not None and self.custom.currentID!="":
				step=int(currentValue.value)+1
				id=self.custom.currentID
				stepdescipt=self.custom.data[currentValue.value].step_descrip
				system.perspective.openPopup("F7Popup",'Exchange/SFC Recipe Handler/F7 Popup', params = {'name':stepdescipt,'step':step,'id':id},title="Function 7", showCloseIcon = True, resizable = True, draggable=True, modal=True)

```

Codes in SFC Startup for function-1:

```python
p1=int(chart.param1)
	p2=int(chart.param2)
	p3=int(chart.param3)
	
	#check time in step that has been paused and what happens during a pause
	StepStartTime=chart.stepStartTime
	pause=chart.stepTotalPause
	pauseAction=chart.pauseAction
	
	
	#add all "times" together"
	StepStartTime=system.date.addSeconds(StepStartTime,pause)
	timePlusHours=system.date.addHours(StepStartTime,p1)
	timePlusMinutes=system.date.addMinutes(timePlusHours,p2)
	endTime=system.date.addSeconds(timePlusMinutes,p3)
	nowTime=system.date.now()
#	system.perspective.openPopup("F7Popup","Exchange/SFC Recipe Handler/F7 Popup" , showCloseIcon = True, resizable = True, draggable=True, modal=True)
	#check if now is after added time
	if system.date.isAfter(nowTime, endTime):
## system.perspective.openPopup("F7Popup","Exchange/SFC Recipe Handler/F7 Popup" , showCloseIcon = True, resizable = True, draggable=True, modal=True)
		chart.stepComplete=True
	
			
	chart.estEndTime=endTime

```

Code in FUNCTION-2:

```python
if chart.writeString is not None:
			tagPath=chart.targetPath1
			system.tag.writeBlocking([tagPath], [chart.writeString])
			val=system.tag.readBlocking([tagPath])[0].value
		if val==chart.writeString:
			chart.stepComplete=True
		if chart.f7Message==False:
			chart.f7Message=True
		

```

I know it was bit unclear and lengthy one. Ready to explain more clearly if need, Trying to achieve this for past one day,but not able to do. Kindly help me to achieve this.

---

<div class="post-metadata">

**Author:** ![bill.liu](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bill.liu](https://forum.inductiveautomation.com/u/bill.liu)\
**Post date:** [July 10, 2024, 9:07pm UTC](https://forum.inductiveautomation.com/t/need-help-in-sfc-functional-flow-modification/93001/2 "2024-07-10T21:07:40Z")

</div>

The value of `custom.endtime` perspective property is of type Date. `currentValue.value` in the property change script refers to the value of the custom property. When you do call `int()` on a Date object it doesn't how how to convert the Date object to a integer.

I think what you wanted to do is reading the `custom.step` perspective property by `self.custom.step`

---

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [July 11, 2024, 7:11am UTC](https://forum.inductiveautomation.com/t/need-help-in-sfc-functional-flow-modification/93001/3 "2024-07-11T07:11:44Z")

</div>

Hey Bill.LIu. Thank you for your reply. Now Actually I can able to get the popup and modified the SFC flow as once popup is opened and clicking the Next button only moves to the next stage. Now Where I was struggling is, I need to open the popup only at the end of the each process. I have start time and end time of each process in custom method.  
I need a help how can I achevie to open the popup whenever time reach the end time of process.  
Example:  
Process 1:  
Startime:10.00.00  
EndTime:10..00.12........So At 10.00.12 I want to open popup  
Process 2:  
Startime 10.00.12  
endtime:10.00.24...so At 100.00.24 I want to open up the popup.

I will have this values of starttime and endtime when process starts.  
Starttime and endtime will populate data in custom method.  
Kindly helpme on this.
