hi Expert
i have a sharepoint list with Case_Number as ID column and my ID is in <Country>-CASE-YYYY-<Number" i,e. US-CASE-2022-001
country has a dropdown as US canada,
Default section of Textinput the following code is inserted to get the last id
Last(Split(Last(Filter(Master, Filename="GOV")).CaseUniqueID,"-")).Result
in form in ON success button:
following code is written:

this will take this 185 and add 1 to the variable IDcounter
Set(IDcounter,LastNumber+1);
now in next portion: there is condition that will check the year and if the date is greater than last date of October than the fiscal year changes and the id number get restarted from 1
in ON success screen of the form following code is written:

If(Month(Today())>=11 && Day(Today())>=1 && CountRows(Filter(Filter(Master,Filename="GOV"),CaseUniqueID=Last(Filter(Master,Filename="GOV")).CaseUniqueID))=0,Set(UniqueCaseID,CountryDDl.Selected.Value&"-Case-" & Year(Today())+1 & "-001"), Set(UniqueCaseID,CountryDDL.Selected.Value&"-Case-" & Text(DateAdd(Now(),2,Months),"[$-en-US]yyyy")&"-"&Text(Value(IDcounter),"[$-en-US]000")));
this above code was supposed to generate the new caseUnqiue id by adding 1 to the last id,
now in save button ONSelect property following code is written to check if the generateded id already exist or not.
If(datacardUniqueID.text=Last(Filter(Master,FileName="GOV")).CaseUniqueID,Notify("DuplicateID",Error),SubmitForm(Form2))
If(datacardUniqueID.text=Last(Filter(Master,FileName="GOV")).CaseUniqueID,Notify("DuplicateID",Error),SubmitForm(Form2))
Now, i am having error as the id is not generated and the country is not selected from the dropdown, further there is title warning in the the save button.
my sharepoint looks similar below. so i am only generating case id based on the filter filename so only id for GOV is generated.
my code is not working please help
| CaseUnqiueID | Name | Country | Filename |
| US-Case-2022-001 | xyz | US | GOV |
| CAn-Case-2022-002 | abc | CAN | GOV |
| docs-case-2022-Ca-001 | dba | CAN | prvt |
| | | | |
please advise