Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with APPLICATION_QUERY()

MetalFingerz
Participant

Hello,

 

First of all, the new forum layout is terrible 🤢

 

Anyway, I'm having an issue with APPLICATION_QUERY() and I tried and tried solutions but to no avail so I come here for help. I have a MEP library part with two connections for water supply. I want to retrieve some info (pens, fills, surfaces) from the Systems list so I can have the piping coming out of it to look as it should.

 

As I do not know the index of the system, I need to retrieve it and then gets some of its info. Here's what I do :

 

DIM SYSTEM_2[][]
S1 = 0
S2 = 0

n1 = APPLICATION_QUERY ("MEPSYSTEM", "GetMEPSystems(2)", SYSTEM_2)

FOR i = 1 TO VARDIM2(SYSTEM_2)
	IF SYSTEM_2[1][i] = ConSystem_1 THEN S1 = SYSTEM_2[1][i-1]
	IF SYSTEM_2[1][i] = ConSystem_2 THEN S2 = SYSTEM_2[1][i-1]
NEXT i

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(S1)", MEPmaterial_1)
n3 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(S2)", MEPmaterial_2)

 

(For this example, I do not check if the n are > 0)

So first query, I get all the piping systems ok. Second and third queries, I can't retrieve the SystemMaterial

 

For info, the GDL reference guide defines it that way : APPLICATION_QUERY (extension_name, parameter_string, variable1, variable2, ...) and it seems that I can't achieve what I want because the second argument of APPLICATION_QUERY() has to be a string so it is read literally and it cannot have a variable but then what's the point ? I can never know for sure the index of the System the user will be inputing so I cannot hardcode the index for GetSystemMaterial(). I tried to have the second argument without quotes but the whole query breaks then.

 

Any workaround ? It seems to be the only solution to retrieve this info 😭. Thanks.

 

Using AC24 on MacOS

1 ACCEPTED SOLUTION

Solution
kuvbur
Booster

 

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + str("%.0", s1) + ")", MEPmaterial_1)

or

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + s1 + ")", MEPmaterial_1)

 

https://github.com/kuvbur

View solution in original post

2 REPLIES 2

Solution
kuvbur
Booster

 

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + str("%.0", s1) + ")", MEPmaterial_1)

or

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + s1 + ")", MEPmaterial_1)

 

https://github.com/kuvbur

View solution in original post

Hello @kuvbur ,

 

Thanks, I didn't think of concatenate it 😓

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!