Updated XMLVars with FS9 version and a gauge example

taguilo

Resource contributor
Hi, I have updated XMLVars.zip with a now working copy for FS9 (FS2004) thanks to Bob and Robbie McElrath's help. I also added a gauge than can be taken as an example on the advantage of using arrays of variables for certain operations, in this case a simulation of a 757/767 CAS system.
I want to thank Bob again for providing the FMS-style gauge that I took as a container for the example (see .jpg image attached)

Comments and suggestions are always welcomed.

Tom
 

Attachments

Tom,

I have found it useful to use (even more) descriptive macros to replace the XMLVar instructions:


Code:
[COLOR="Blue"]<Macro Name="MakeName">(>C:XMLVARS:StoreVarName, string)</Macro>
<Macro Name="FindIndex">(>C:XMLVARS:SearchVarName, string)</Macro>	
<Macro Name="WriteString">(>C:XMLVARS:StringValue, string)</Macro>
<Macro Name="ReadString">(C:XMLVARS:StringValue, string)</Macro>
<Macro Name="WriteNumber">(>C:XMLVARS:NumberValue, number)</Macro>
<Macro Name="ReadNumber">(C:XMLVARS:NumberValue, number)</Macro>[/COLOR]

And one issue. Using XMLVars, I want to create a string that is a concatenation of strings and a gps integer. I want the new string to be in the form of KHUT-KICT-WPT11 but I get KHUT-KICT-WPT11. with a decimal point. The decimal point is messing up my plans. Can XMLVar be tweaked to drop the decimal point when the number is an integer?

My XML code:


Code:
[COLOR="Blue"]<Area Name="SAVE CURRENT FP Button" Left="5" Top="5" Width="15" Height="15">
	<Cursor Type="Hand" />		
	<Click Kind="LeftSingle">
		(@c:FlightPlanWaypointsNumber) (>L:NumberFlightPlanWpts, enum) [/COLOR]
[COLOR="Green"]	<!-- CREATE XMLVar STRING VAR -->[/COLOR]
[COLOR="Blue"]		'FPOriginName' @MakeName						
		0 (>@c:FlightPlanWaypointIndex)	
		(@c:FlightPlanWaypointIdent) @WriteString[/COLOR]
[COLOR="Green"]	<!-- CREATE XMLVar STRING VAR -->[/COLOR]
[COLOR="Blue"]		'FPDestinationName' @MakeName	
		(@c:FlightPlanWaypointsNumber) 1 - (>@c:FlightPlanWaypointIndex)	
		(@c:FlightPlanWaypointIdent) @WriteString[/COLOR]
[COLOR="Green"]	<!-- CREATE TWO XMLVar STRING VARs -->[/COLOR]
[COLOR="Blue"]		'NewFPFileNameNoExtension' @MakeName
		'NewFPFileNameFullPath' @MakeName[/COLOR]					
[COLOR="Green"]	<!-- CONSTRUCT THE FLIGHT PLAN FILE NAME -->	[/COLOR]				
[COLOR="Blue"]			'FPOriginName' @FindIndex @ReadString
			'-' scat
			'FPDestinationName' @FindIndex @ReadString scat
			'-WPT' scat
			(@c:FlightPlanWaypointsNumber) scat 
			'NewFPFileNameNoExtension' @FindIndex @WriteString
			@Path @ReadString scat '.csv' scat
			'NewFPFileNameFullPath' @FindIndex @WriteString[/COLOR]
[COLOR="Green"]	<!-- PASS THE FULL PATH FILE NAME TO LOGGER:openWrite -->	[/COLOR]					
[COLOR="Blue"]		(>C:LOGGER:openWrite)
		1 (>L:SavingFlightPlan, enum)
		0 (>L:NumberFlightPlanWptsSaved, enum)
	</Click>
</Area>	[/COLOR]
Bob
 
Last edited:

taguilo

Resource contributor
Tom,

I have found it useful to use (even more) descriptive macros to replace the XMLVar instructions:


Code:
[COLOR="Blue"]<Macro Name="MakeName">(>C:XMLVARS:StoreVarName, string)</Macro>
<Macro Name="FindIndex">(>C:XMLVARS:SearchVarName, string)</Macro>	
<Macro Name="WriteString">(>C:XMLVARS:StringValue, string)</Macro>
<Macro Name="ReadString">(C:XMLVARS:StringValue, string)</Macro>
<Macro Name="WriteNumber">(>C:XMLVARS:NumberValue, number)</Macro>
<Macro Name="ReadNumber">(C:XMLVARS:NumberValue, number)</Macro>[/COLOR]

And one issue. Using XMLVars, I want to create a string that is a concatenation of strings and a gps integer. I want the new string to be in the form of KHUT-KICT-WPT11 but I get KHUT-KICT-WPT11. with a decimal point. The decimal point is messing up my plans. Can XMLVar be tweaked to drop the decimal point when the number is an integer?

My XML code:


Code:
[COLOR="Blue"]<Area Name="SAVE CURRENT FP Button" Left="5" Top="5" Width="15" Height="15">
	<Cursor Type="Hand" />		
	<Click Kind="LeftSingle">
		(@c:FlightPlanWaypointsNumber) (>L:NumberFlightPlanWpts, enum) [/COLOR]
[COLOR="Green"]	<!-- CREATE XMLVar STRING VAR -->[/COLOR]
[COLOR="Blue"]		'FPOriginName' @MakeName						
		0 (>@c:FlightPlanWaypointIndex)	
		(@c:FlightPlanWaypointIdent) @WriteString[/COLOR]
[COLOR="Green"]	<!-- CREATE XMLVar STRING VAR -->[/COLOR]
[COLOR="Blue"]		'FPDestinationName' @MakeName	
		(@c:FlightPlanWaypointsNumber) 1 - (>@c:FlightPlanWaypointIndex)	
		(@c:FlightPlanWaypointIdent) @WriteString[/COLOR]
[COLOR="Green"]	<!-- CREATE TWO XMLVar STRING VARs -->[/COLOR]
[COLOR="Blue"]		'NewFPFileNameNoExtension' @MakeName
		'NewFPFileNameFullPath' @MakeName[/COLOR]					
[COLOR="Green"]	<!-- CONSTRUCT THE FLIGHT PLAN FILE NAME -->	[/COLOR]				
[COLOR="Blue"]			'FPOriginName' @FindIndex @ReadString
			'-' scat
			'FPDestinationName' @FindIndex @ReadString scat
			'-WPT' scat
			(@c:FlightPlanWaypointsNumber) scat 
			'NewFPFileNameNoExtension' @FindIndex @WriteString
			@Path @ReadString scat '.csv' scat
			'NewFPFileNameFullPath' @FindIndex @WriteString[/COLOR]
[COLOR="Green"]	<!-- PASS THE FULL PATH FILE NAME TO LOGGER:openWrite -->	[/COLOR]					
[COLOR="Blue"]		(>C:LOGGER:openWrite)
		1 (>L:SavingFlightPlan, enum)
		0 (>L:NumberFlightPlanWptsSaved, enum)
	</Click>
</Area>	[/COLOR]
Bob
Hi Bob, good work!:)

Instead of this:

(@c:FlightPlanWaypointsNumber) scat

Write this:

(@c:FlightPlanWaypointsNumber) int scat

I think you did a good work with those macros. However, your approach should be used very carefully because a little difference in the way it is coded could lead to erroneous results.
Let me show the same script using a single universal macro:

Code:
<Macro Name="V">
   @1 d 0 symb '>' scmi 0 == 
	 if{ (>C:XMLVARS:StoreVarName,string) (>C:XMLVARS:@2Value,@2) } 
	 els{ (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:@2Value,@2) }	 
</Macro>

<Area Name="SAVE CURRENT FP Button" Left="5" Top="5" Width="15" Height="15">
	<Cursor Type="Hand" />		
	<Click Kind="LeftSingle">
		(@c:FlightPlanWaypointsNumber) (>L:NumberFlightPlanWpts, enum) 
	<!-- CREATE XMLVar STRING VAR -->
		0 (>@c:FlightPlanWaypointIndex)	
		(@c:FlightPlanWaypointIdent) @V('>FPOriginName',string) 
	<!-- CREATE XMLVar STRING VAR -->
		(@c:FlightPlanWaypointsNumber) 1 (>@c:FlightPlanWaypointIndex)	
		(@c:FlightPlanWaypointIdent) @V('>FPDestinationName',string) 

	<!-- CREATE TWO XMLVar STRING VARs -->
               -- NO NEED TO DO THIS----
					
	<!-- CONSTRUCT THE FLIGHT PLAN FILE NAME -->	
                        @V('FPOriginName',string) '-' scat				
                        @V('FPDestinationnName',string) '-' scat 
			'-WPT' scat
			(@c:FlightPlanWaypointsNumber) int scat 
                        @V(>'NewFPFileNameNoExtension',string)
			@Path @V('NewFPFileNameNoExtension',string) scat '.csv' scat
                        @V(>'NewFPFileNameFullPath',string)
	<!-- PASS THE FULL PATH FILE NAME TO LOGGER:openWrite -->						
		(>C:LOGGER:openWrite)
		1 (>L:SavingFlightPlan, enum)
		0 (>L:NumberFlightPlanWptsSaved, enum)
	</Click>
</Area>
Tom
 
Let me show the same script using a single universal macro:
Tom
I always enjoy reading your work because I learn a lot. I would never have thought of your universal macro, but I understand your approach, so maybe next time I will be more efficient. Thank you!

Why don't you go ahead and post your response to the Paging challenge posted by Joao in http://fsdeveloper.com/forum/showthread.php?t=157527&page=3.

I will follow with the more clumsy, but still operational LOGGER-only approach.

Bob
 
Tom,

Some other "ah-ha's" using XMLVars:

1 - I should not try to store a complete file path into an XMLVar string because the path includes the \ symbol that is interpreted as an escape character, and the subsequent letter is dropped:


C:\Documents and Settings\User\Desktop\FlightPlanTest\

becomes

C:eek:cuments and SettingsseresktoplightPlanTest

2 - I believe XMLVars can be used to dynamically create variables as FS runs. Is this correct? I have sometimes had the need to create an L:Var in the form of L:VarX where X is a number generated as FS runs. I do not believe this is possible in the FS L:Var scheme of things, but there are occasions when it would certainly be useful. Perhaps XMLVars are a way to accomplish this.

Bob
 

taguilo

Resource contributor
Tom,

Some other "ah-ha's" using XMLVars:

1 - I should not try to store a complete file path into an XMLVar string because the path includes the \ symbol that is interpreted as an escape character, and the subsequent letter is dropped:

C:\Documents and Settings\User\Desktop\FlightPlanTest\

becomes

C:eek:cuments and SettingsseresktoplightPlanTest

The escape character (\) is recognized and treated with a C++ logic. Therefore, you must write a path using:

C:\\Documents and Settings\\User\\Desktop\\FlightPlanTest\\

and that's it.



2 - I believe XMLVars can be used to dynamically create variables as FS runs. Is this correct? I have sometimes had the need to create an L:Var in the form of L:VarX where X is a number generated as FS runs. I do not believe this is possible in the FS L:Var scheme of things, but there are occasions when it would certainly be useful. Perhaps XMLVars are a way to accomplish this.

Bob
Well, dynamically create variables as FS runs is the main goal of the module indeed. A perfect example is contained in the gauge I included in the update, XMLVarsExample.xml. I strongly recommend you to inspect the code and see how a group of array variables are dynamically created to compose the CAS's simulated system. Fair to say it is not an easy logic, but not a terrible difficult either.

Tom
 
Well, dynamically create variables as FS runs is the main goal of the module indeed. A perfect example is contained in the gauge I included in the update, XMLVarsExample.xml. I strongly recommend you to inspect the code and see how a group of array variables are dynamically created to compose the CAS's simulated system.
Right ... I need to study that code. But now, I am beginning to understand what you mean by array. This is a very important upgrade to XML variable capability.
 

n4gix

Resource contributor
Here is an example of a table that is a perfect candidate for an array. It would allow one to lookup Vle speed based on gross weight and flap positions:

Gross Wt x1000.....Ref Speed at Flap Position
............................40.....30.....25.....15
==============================
110......................138...142...153...158
105......................134...128...149...154
100......................130...135...144...150
etc.
.70.......................109...112...119...123
 

taguilo

Resource contributor
Here is an example of a table that is a perfect candidate for an array.
Yes, that is a perfect candidate. Another candidates are the macro arrays that I developed and found to be the best workaround solution for the lack of FS native support with its LVar system.

This is a graphical example of what I had to write for saving a hundred waypoints latitude and longitude info from a loaded flight plan into three local variables:

(L:FP Ident1_n,number)
(L:FP Lat1_n,number)
(L:FP Lon1_n,number)

where n goes from 1 to 100

Here is the original code (from 2007)

Code:
  <Macro Name="FPSet">
 		l0 @1 == if{ l20 (>L:FP Ident@2_@1,number) l21 (>L:FP Lat@2_@1,number) l22 (>L:FP Lon@2_@1,number) }
 </Macro>

  <Macro Name="FPMain">
		@1(1,@2) @1(2,@2) @1(3,@2) @1(4,@2) @1(5,@2) @1(6,@2) @1(7,@2) @1(8,@2) @1(9,@2) @1(10,@2)  
		@1(11,@2) @1(12,@2) @1(13,@2) @1(14,@2) @1(15,@2) @1(16,@2) @1(17,@2) @1(18,@2) @1(19,@2) @1(20,@2)  
		@1(21,@2) @1(22,@2) @1(23,@2) @1(24,@2) @1(25,@2) @1(26,@2) @1(27,@2) @1(28,@2) @1(29,@2) @1(30,@2)  
		@1(31,@2) @1(32,@2) @1(33,@2) @1(34,@2) @1(35,@2) @1(36,@2) @1(37,@2) @1(38,@2) @1(39,@2) @1(40,@2)  
		@1(41,@2) @1(42,@2) @1(43,@2) @1(44,@2) @1(45,@2) @1(46,@2) @1(47,@2) @1(48,@2) @1(49,@2) @1(50,@2)  
		@1(51,@2) @1(52,@2) @1(53,@2) @1(54,@2) @1(55,@2) @1(56,@2) @1(57,@2) @1(58,@2) @1(59,@2) @1(60,@2)  
		@1(61,@2) @1(62,@2) @1(63,@2) @1(64,@2) @1(65,@2) @1(66,@2) @1(67,@2) @1(68,@2) @1(69,@2) @1(70,@2)  
		@1(71,@2) @1(72,@2) @1(73,@2) @1(74,@2) @1(75,@2) @1(76,@2) @1(77,@2) @1(78,@2) @1(79,@2) @1(80,@2)  
		@1(81,@2) @1(82,@2) @1(83,@2) @1(84,@2) @1(85,@2) @1(86,@2) @1(87,@2) @1(88,@2) @1(89,@2) @1(90,@2)  
		@1(91,@2) @1(92,@2) @1(93,@2) @1(94,@2) @1(95,@2) @1(96,@2) @1(97,@2) @1(98,@2) @1(99,@2) @1(100,@2)  
 </Macro>	

<Update>
	0 sp0 
	:300
	l0 1 + sp20
	(gpsWaypointLat) sp21
	(gpsWaypointLon) sp22
	@FPMain(@FPSet,1)
	l0 ++ s0 100 &lt;= if{ g300 }
<Update>
And this is the new code using XMLVars array variables:

Code:
<Macro Name="Va1">
   @1 d 0 symb '>' scmi 0 == 
	 if{ @3 scat (>C:XMLVARS:StoreVarName,string) (>C:XMLVARS:@2Value,@2) } 
	 els{ @3 scat (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:@2Value,@2) }	 
</Macro>

<Update>
	0 sp0 
	:300
	l0 1 + sp20
	l20 @Va1('>FP_Ident1:',number,l20)
	(gpsWaypointLat) @Va1('>FP_Lat1:',number,l20)
	(gpsWaypointLon) @Va1('>FP_Lon1:',number,l20)
	l0 ++ s0 100 &lt; if{ g300 }
<Update>
Now, here you can see how FS XML parser actually translate everything to runtime code:

First, the macro array solution:

Code:
<Update>
		0 sp0 
		:300
		l0 1 + sp20
		(gpsWaypointLat) sp21
		(gpsWaypointLon) sp22
 		l0 1 == if{ l20 (>L:FP Ident1_1,number) l21 (>L:FP Lat1_1,number) l22 (>L:FP Lon1_1,number) }
 		l0 2 == if{ l20 (>L:FP Ident1_2,number) l21 (>L:FP Lat1_2,number) l22 (>L:FP Lon1_2,number) }
 		l0 3 == if{ l20 (>L:FP Ident1_3,number) l21 (>L:FP Lat1_3,number) l22 (>L:FP Lon1_3,number) }
 		l0 4 == if{ l20 (>L:FP Ident1_4,number) l21 (>L:FP Lat1_4,number) l22 (>L:FP Lon1_4,number) }
 		l0 5 == if{ l20 (>L:FP Ident1_5,number) l21 (>L:FP Lat1_5,number) l22 (>L:FP Lon1_5,number) }
 		l0 6 == if{ l20 (>L:FP Ident1_6,number) l21 (>L:FP Lat1_6,number) l22 (>L:FP Lon1_6,number) }
 		l0 7 == if{ l20 (>L:FP Ident1_7,number) l21 (>L:FP Lat1_7,number) l22 (>L:FP Lon1_7,number) }
 		l0 8 == if{ l20 (>L:FP Ident1_8,number) l21 (>L:FP Lat1_8,number) l22 (>L:FP Lon1_8,number) }
 		l0 9 == if{ l20 (>L:FP Ident1_9,number) l21 (>L:FP Lat1_9,number) l22 (>L:FP Lon1_9,number) }
 		l0 10 == if{ l20 (>L:FP Ident1_10,number) l21 (>L:FP Lat1_10,number) l22 (>L:FP Lon1_10,number) }
 		l0 11 == if{ l20 (>L:FP Ident1_11,number) l21 (>L:FP Lat1_11,number) l22 (>L:FP Lon1_11,number) }
 		l0 12 == if{ l20 (>L:FP Ident1_12,number) l21 (>L:FP Lat1_12,number) l22 (>L:FP Lon1_12,number) }
 		l0 13 == if{ l20 (>L:FP Ident1_13,number) l21 (>L:FP Lat1_13,number) l22 (>L:FP Lon1_13,number) }
 		l0 14 == if{ l20 (>L:FP Ident1_14,number) l21 (>L:FP Lat1_14,number) l22 (>L:FP Lon1_14,number) }
 		l0 15 == if{ l20 (>L:FP Ident1_15,number) l21 (>L:FP Lat1_15,number) l22 (>L:FP Lon1_15,number) }
 		l0 16 == if{ l20 (>L:FP Ident1_16,number) l21 (>L:FP Lat1_16,number) l22 (>L:FP Lon1_16,number) }
 		l0 17 == if{ l20 (>L:FP Ident1_17,number) l21 (>L:FP Lat1_17,number) l22 (>L:FP Lon1_17,number) }
 		l0 18 == if{ l20 (>L:FP Ident1_18,number) l21 (>L:FP Lat1_18,number) l22 (>L:FP Lon1_18,number) }
 		l0 19 == if{ l20 (>L:FP Ident1_19,number) l21 (>L:FP Lat1_19,number) l22 (>L:FP Lon1_19,number) }
 		l0 20 == if{ l20 (>L:FP Ident1_20,number) l21 (>L:FP Lat1_20,number) l22 (>L:FP Lon1_20,number) }
 		l0 21 == if{ l20 (>L:FP Ident1_21,number) l21 (>L:FP Lat1_21,number) l22 (>L:FP Lon1_21,number) }
 		l0 22 == if{ l20 (>L:FP Ident1_22,number) l21 (>L:FP Lat1_22,number) l22 (>L:FP Lon1_22,number) }
 		l0 23 == if{ l20 (>L:FP Ident1_23,number) l21 (>L:FP Lat1_23,number) l22 (>L:FP Lon1_23,number) }
 		l0 24 == if{ l20 (>L:FP Ident1_24,number) l21 (>L:FP Lat1_24,number) l22 (>L:FP Lon1_24,number) }
 		l0 25 == if{ l20 (>L:FP Ident1_25,number) l21 (>L:FP Lat1_25,number) l22 (>L:FP Lon1_25,number) }
 		l0 26 == if{ l20 (>L:FP Ident1_26,number) l21 (>L:FP Lat1_26,number) l22 (>L:FP Lon1_26,number) }
 		l0 27 == if{ l20 (>L:FP Ident1_27,number) l21 (>L:FP Lat1_27,number) l22 (>L:FP Lon1_27,number) }
 		l0 28 == if{ l20 (>L:FP Ident1_28,number) l21 (>L:FP Lat1_28,number) l22 (>L:FP Lon1_28,number) }
 		l0 29 == if{ l20 (>L:FP Ident1_29,number) l21 (>L:FP Lat1_29,number) l22 (>L:FP Lon1_29,number) }
 		l0 30 == if{ l20 (>L:FP Ident1_30,number) l21 (>L:FP Lat1_30,number) l22 (>L:FP Lon1_30,number) }
 		l0 31 == if{ l20 (>L:FP Ident1_31,number) l21 (>L:FP Lat1_31,number) l22 (>L:FP Lon1_31,number) }
 		l0 32 == if{ l20 (>L:FP Ident1_32,number) l21 (>L:FP Lat1_32,number) l22 (>L:FP Lon1_32,number) }
 		l0 33 == if{ l20 (>L:FP Ident1_33,number) l21 (>L:FP Lat1_33,number) l22 (>L:FP Lon1_33,number) }
 		l0 34 == if{ l20 (>L:FP Ident1_34,number) l21 (>L:FP Lat1_34,number) l22 (>L:FP Lon1_34,number) }
 		l0 35 == if{ l20 (>L:FP Ident1_35,number) l21 (>L:FP Lat1_35,number) l22 (>L:FP Lon1_35,number) }
 		l0 36 == if{ l20 (>L:FP Ident1_36,number) l21 (>L:FP Lat1_36,number) l22 (>L:FP Lon1_36,number) }
 		l0 37 == if{ l20 (>L:FP Ident1_37,number) l21 (>L:FP Lat1_37,number) l22 (>L:FP Lon1_37,number) }
 		l0 38 == if{ l20 (>L:FP Ident1_38,number) l21 (>L:FP Lat1_38,number) l22 (>L:FP Lon1_38,number) }
 		l0 39 == if{ l20 (>L:FP Ident1_39,number) l21 (>L:FP Lat1_39,number) l22 (>L:FP Lon1_39,number) }
 		l0 40 == if{ l20 (>L:FP Ident1_40,number) l21 (>L:FP Lat1_40,number) l22 (>L:FP Lon1_40,number) }
 		l0 41 == if{ l20 (>L:FP Ident1_41,number) l21 (>L:FP Lat1_41,number) l22 (>L:FP Lon1_41,number) }
 		l0 42 == if{ l20 (>L:FP Ident1_42,number) l21 (>L:FP Lat1_42,number) l22 (>L:FP Lon1_42,number) }
 		l0 43 == if{ l20 (>L:FP Ident1_43,number) l21 (>L:FP Lat1_43,number) l22 (>L:FP Lon1_43,number) }
 		l0 44 == if{ l20 (>L:FP Ident1_44,number) l21 (>L:FP Lat1_44,number) l22 (>L:FP Lon1_44,number) }
 		l0 45 == if{ l20 (>L:FP Ident1_45,number) l21 (>L:FP Lat1_45,number) l22 (>L:FP Lon1_45,number) }
 		l0 46 == if{ l20 (>L:FP Ident1_46,number) l21 (>L:FP Lat1_46,number) l22 (>L:FP Lon1_46,number) }
 		l0 47 == if{ l20 (>L:FP Ident1_47,number) l21 (>L:FP Lat1_47,number) l22 (>L:FP Lon1_47,number) }
 		l0 48 == if{ l20 (>L:FP Ident1_48,number) l21 (>L:FP Lat1_48,number) l22 (>L:FP Lon1_48,number) }
 		l0 49 == if{ l20 (>L:FP Ident1_49,number) l21 (>L:FP Lat1_49,number) l22 (>L:FP Lon1_49,number) }
 		l0 50 == if{ l20 (>L:FP Ident1_50,number) l21 (>L:FP Lat1_50,number) l22 (>L:FP Lon1_50,number) }
 		l0 51 == if{ l20 (>L:FP Ident1_51,number) l21 (>L:FP Lat1_51,number) l22 (>L:FP Lon1_51,number) }
 		l0 52 == if{ l20 (>L:FP Ident1_52,number) l21 (>L:FP Lat1_52,number) l22 (>L:FP Lon1_52,number) }
 		l0 53 == if{ l20 (>L:FP Ident1_53,number) l21 (>L:FP Lat1_53,number) l22 (>L:FP Lon1_53,number) }
 		l0 54 == if{ l20 (>L:FP Ident1_54,number) l21 (>L:FP Lat1_54,number) l22 (>L:FP Lon1_54,number) }
 		l0 55 == if{ l20 (>L:FP Ident1_55,number) l21 (>L:FP Lat1_55,number) l22 (>L:FP Lon1_55,number) }
 		l0 56 == if{ l20 (>L:FP Ident1_56,number) l21 (>L:FP Lat1_56,number) l22 (>L:FP Lon1_56,number) }
 		l0 57 == if{ l20 (>L:FP Ident1_57,number) l21 (>L:FP Lat1_57,number) l22 (>L:FP Lon1_57,number) }
 		l0 58 == if{ l20 (>L:FP Ident1_58,number) l21 (>L:FP Lat1_58,number) l22 (>L:FP Lon1_58,number) }
 		l0 59 == if{ l20 (>L:FP Ident1_59,number) l21 (>L:FP Lat1_59,number) l22 (>L:FP Lon1_59,number) }
 		l0 60 == if{ l20 (>L:FP Ident1_60,number) l21 (>L:FP Lat1_60,number) l22 (>L:FP Lon1_60,number) }
 		l0 61 == if{ l20 (>L:FP Ident1_61,number) l21 (>L:FP Lat1_61,number) l22 (>L:FP Lon1_61,number) }
 		l0 62 == if{ l20 (>L:FP Ident1_62,number) l21 (>L:FP Lat1_62,number) l22 (>L:FP Lon1_62,number) }
 		l0 63 == if{ l20 (>L:FP Ident1_63,number) l21 (>L:FP Lat1_63,number) l22 (>L:FP Lon1_63,number) }
 		l0 64 == if{ l20 (>L:FP Ident1_64,number) l21 (>L:FP Lat1_64,number) l22 (>L:FP Lon1_64,number) }
 		l0 65 == if{ l20 (>L:FP Ident1_65,number) l21 (>L:FP Lat1_65,number) l22 (>L:FP Lon1_65,number) }
 		l0 66 == if{ l20 (>L:FP Ident1_66,number) l21 (>L:FP Lat1_66,number) l22 (>L:FP Lon1_66,number) }
 		l0 67 == if{ l20 (>L:FP Ident1_67,number) l21 (>L:FP Lat1_67,number) l22 (>L:FP Lon1_67,number) }
 		l0 68 == if{ l20 (>L:FP Ident1_68,number) l21 (>L:FP Lat1_68,number) l22 (>L:FP Lon1_68,number) }
 		l0 69 == if{ l20 (>L:FP Ident1_69,number) l21 (>L:FP Lat1_69,number) l22 (>L:FP Lon1_69,number) }
 		l0 70 == if{ l20 (>L:FP Ident1_70,number) l21 (>L:FP Lat1_70,number) l22 (>L:FP Lon1_70,number) }
 		l0 71 == if{ l20 (>L:FP Ident1_71,number) l21 (>L:FP Lat1_71,number) l22 (>L:FP Lon1_71,number) }
 		l0 72 == if{ l20 (>L:FP Ident1_72,number) l21 (>L:FP Lat1_72,number) l22 (>L:FP Lon1_72,number) }
 		l0 73 == if{ l20 (>L:FP Ident1_73,number) l21 (>L:FP Lat1_73,number) l22 (>L:FP Lon1_73,number) }
 		l0 74 == if{ l20 (>L:FP Ident1_74,number) l21 (>L:FP Lat1_74,number) l22 (>L:FP Lon1_74,number) }
 		l0 75 == if{ l20 (>L:FP Ident1_75,number) l21 (>L:FP Lat1_75,number) l22 (>L:FP Lon1_75,number) }
 		l0 76 == if{ l20 (>L:FP Ident1_76,number) l21 (>L:FP Lat1_76,number) l22 (>L:FP Lon1_76,number) }
 		l0 77 == if{ l20 (>L:FP Ident1_77,number) l21 (>L:FP Lat1_77,number) l22 (>L:FP Lon1_77,number) }
 		l0 78 == if{ l20 (>L:FP Ident1_78,number) l21 (>L:FP Lat1_78,number) l22 (>L:FP Lon1_78,number) }
 		l0 79 == if{ l20 (>L:FP Ident1_79,number) l21 (>L:FP Lat1_79,number) l22 (>L:FP Lon1_79,number) }
 		l0 80 == if{ l20 (>L:FP Ident1_80,number) l21 (>L:FP Lat1_80,number) l22 (>L:FP Lon1_80,number) }
 		l0 81 == if{ l20 (>L:FP Ident1_81,number) l21 (>L:FP Lat1_81,number) l22 (>L:FP Lon1_81,number) }
 		l0 82 == if{ l20 (>L:FP Ident1_82,number) l21 (>L:FP Lat1_82,number) l22 (>L:FP Lon1_82,number) }
 		l0 83 == if{ l20 (>L:FP Ident1_83,number) l21 (>L:FP Lat1_83,number) l22 (>L:FP Lon1_83,number) }
 		l0 84 == if{ l20 (>L:FP Ident1_84,number) l21 (>L:FP Lat1_84,number) l22 (>L:FP Lon1_84,number) }
 		l0 85 == if{ l20 (>L:FP Ident1_85,number) l21 (>L:FP Lat1_85,number) l22 (>L:FP Lon1_85,number) }
 		l0 86 == if{ l20 (>L:FP Ident1_86,number) l21 (>L:FP Lat1_86,number) l22 (>L:FP Lon1_86,number) }
 		l0 87 == if{ l20 (>L:FP Ident1_87,number) l21 (>L:FP Lat1_87,number) l22 (>L:FP Lon1_87,number) }
 		l0 88 == if{ l20 (>L:FP Ident1_88,number) l21 (>L:FP Lat1_88,number) l22 (>L:FP Lon1_88,number) }
 		l0 89 == if{ l20 (>L:FP Ident1_89,number) l21 (>L:FP Lat1_89,number) l22 (>L:FP Lon1_89,number) }
 		l0 90 == if{ l20 (>L:FP Ident1_90,number) l21 (>L:FP Lat1_90,number) l22 (>L:FP Lon1_90,number) }
 		l0 91 == if{ l20 (>L:FP Ident1_91,number) l21 (>L:FP Lat1_91,number) l22 (>L:FP Lon1_91,number) }
 		l0 92 == if{ l20 (>L:FP Ident1_92,number) l21 (>L:FP Lat1_92,number) l22 (>L:FP Lon1_92,number) }
 		l0 93 == if{ l20 (>L:FP Ident1_93,number) l21 (>L:FP Lat1_93,number) l22 (>L:FP Lon1_93,number) }
 		l0 94 == if{ l20 (>L:FP Ident1_94,number) l21 (>L:FP Lat1_94,number) l22 (>L:FP Lon1_94,number) }
 		l0 95 == if{ l20 (>L:FP Ident1_95,number) l21 (>L:FP Lat1_95,number) l22 (>L:FP Lon1_95,number) }
 		l0 96 == if{ l20 (>L:FP Ident1_96,number) l21 (>L:FP Lat1_96,number) l22 (>L:FP Lon1_96,number) }
 		l0 97 == if{ l20 (>L:FP Ident1_97,number) l21 (>L:FP Lat1_97,number) l22 (>L:FP Lon1_97,number) }
 		l0 98 == if{ l20 (>L:FP Ident1_98,number) l21 (>L:FP Lat1_98,number) l22 (>L:FP Lon1_98,number) }
 		l0 99 == if{ l20 (>L:FP Ident1_99,number) l21 (>L:FP Lat1_99,number) l22 (>L:FP Lon1_99,number) }
 		l0 100 == if{ l20 (>L:FP Ident1_100,number) l21 (>L:FP Lat1_100,number) l22 (>L:FP Lon1_100,number) }
		l0 ++ s0 100 &lt;= if{ g300 }
<Update>




Now the XMLVars array solution:


Code:
<Update>
    0 sp0 
    :300
    l0 1 + sp20
    l20 '>FP_Ident1:' d 0 symb '>' scmi 0 ==
    if{ l20 scat (>C:XMLVARS:StoreVarName,string) (>C:XMLVARS:numberValue,number) } 
    els{ l20 scat (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:numberValue,number) }	 
    (gpsWaypointLat) '>FP_Lat1:' d 0 symb '>' scmi 0 ==
    if{ l20 scat (>C:XMLVARS:StoreVarName,string) (>C:XMLVARS:numberValue,number) } 
    els{ l20 scat (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:numberValue,number) }	 
    (gpsWaypointLon) '>FP_Lon1:' d 0 symb '>' scmi 0 ==
    if{ l20 scat (>C:XMLVARS:StoreVarName,string) (>C:XMLVARS:numberValue,number) } 
    els{ l20 scat (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:numberValue,number) }	 
    l0 ++ s0 100 &lt; if{ g300 }
<Update>
I guess this is pretty self explanatory :)

Tom
 

n4gix

Resource contributor
The table I've used as an example would of course already exist since it is strictly a lookup table used to find a single value. It is a simple 9x4 table. Would the file then look something like this?

filename: LandingSpeed.txt

138,142,153,158
134,138,149,154
130,135,144,150
127,131,140,145
123,127,136,141
119,124,132,136
115,120,127,132
113,116,123,127
109,112,119,123

For lookup then, the lines are (L:GrossWt,enum) and the columns are (L:Vle,enum).
 
Top